Avinash Kumar Gautam
Avinash Kumar Gautam

Reputation: 100

Send image via OpenTok signalling

I am using OpenTok SDK for having session connectivity between devices. I am able to send messages and text top devices connected in a session.

I have a requirement of sending image. Does OpenTok provide the feature for sending image in a session?

Upvotes: 1

Views: 723

Answers (2)

wobbals
wobbals

Reputation: 374

Because of the size constraint of the signals that Aiham mentioned, I did some experimentation with using AWS S3 as an intermediary to store the file during the transfer. The basic workflow is:

  1. Client A uploads file to S3.
  2. Upon upload completion, Client A sends OpenTok signal to Client B indicating a file is available for download.
  3. Upon receiving signal, Client B downloads file from S3.
  4. A file is transferred.

Using this approach, the signal payload limit is not as much of an issue, since the only data being sent over the OpenTok session is what's needed to download the file from S3.

I wouldn't call it a complete solution, but it might be enough to get you started:

https://github.com/wobbals/S3FileSharing

Upvotes: 2

aiham
aiham

Reputation: 3614

You can use the data URI scheme to represent an image as base64 text and transmit it using the signaling API.

However please note you will only be able to send very small images as part of the signaling API as the size limit is 8KB

The data property of the signal parameter is the data string you send with the message. This property is optional. If you omit it, the message will be sent without a data payload. The limit to the size of data is 8KB.

See:

Upvotes: 1

Related Questions