I’m trying to implement a multimedia chat capability in my application and using session.signal to send text, voice and image messages.
I have managed to get text and voice working, however when trying to send images the connection is dropped and automatically reconnected without the SignalEvent being sent:
main.183a09b8ec6afd7a.js:1 Websocket connection lost (reconnecting)
main.183a09b8ec6afd7a.js:1 Websocket reconnected
main.183a09b8ec6afd7a.js:1 Recovered connection in Session BA123
main.183a09b8ec6afd7a.js:1 Re-establishing media connections…
main.183a09b8ec6afd7a.js:1 There were no media streams in need of a reconnection
the images is base64 encoded and just less than 500kB in size.
I’ve checked the documentation and there is no mention of a maximum data payload size for session.signal.
Is my only option to bypass session.signal and transfer the large messages via a separate application server API?
With further tests I’ve found that a data payload of just less than 50kB works, however a data payload of 60kB fails.
Signaling API is not designed to send large chunks of data. If you want to share multimedia files or other big pieces of data, you will have to build that on top of OpenVidu connections.
hmm… supporting multimedia chat does not feel like an unreasonable requirement for a video/voice/text comms API… common functionality in most messaging apps these days like WhatsApp, Facebook Messanger, etc.
The data channels of most WebRTC implementations do not support large chunks of data, since this is not what this channel is supposed to be used for.
You could serialize and chunk your data and send it in smaller packets. Or (temporarily) upload them to a server and only send information about where to find the data (e.g. a download link).
I’ve opted to do something similar, I’m using signal to transfer the metadata of the media message and the tus protocol for resumable upload of the larger image/audio/video recordings, using the tus-js-client and tus-node-server in my fastify application server api.