Search code examples
androidpubnub

Send Attachments using PubNub SDK


currently I am working on a chat application using PubNub SDK. I have visited through PubNub Publish/Subscribe guide , As I am getting It has functionality to send text messages ,but I didn't find a way to send attachments (Images /Audio /Videos ). I have searched over blogs (stackoverflow,github) but didn't find the answer . I am confused whether PubNub supports attachments or not . Can anybody help me to find out the real solution .


Solution

  • New PubNub Feature Update

    PubNub now support File Upload as a native feature in its SDKs. See JavaScript SDK Docs for more details. Change the SDK selection to choose your preferred language. If the feature isn't yet supported in a particular SDK, just let PN support know you need it.

    File Upload is also implemented in the PubNub Chat Framework.


    The following is still valid but no longer necessary.

    PubNub File Sharing Best Practice/Options

    PubNub supports non-binary data up to 32KB per published message. If you were sending attachments, you would likely just upload the file to a hosted file system like Amazon S3, Google Drive or the like and then publish the resulting URL to the hosted file via PubNub.

    There is a way to break the file up in to multiple chunks (< 32KB) and reassemble to on the subscriber end but this is not the optimal way to share files. The above is best practice.