Working with more than one data channel per subscriber<->publisher

34 views
Skip to first unread message

skofo

unread,
Aug 3, 2022, 11:23:12 AM8/3/22
to meetecho-janus
Hello, 

coming from successfully being able to transfer data via the data channels using the approach described here I now attached two data channels to a publisher and a subscriber. I can easily send the data via the channels, which are both shown as "connected".

However, on the subscriber side, I receive the data from both channels one on channel, causing errors since both channels expect differently formatted input. 

I tried adding two "default datachannels" but that did not work either. The channel that receives data is the channel that I register first. 

Should that work or does Janus not support this right now?

Adrien Martin

unread,
Aug 16, 2022, 4:40:00 AM8/16/22
to meetecho-janus
Can I ask why did you want to use different data channels?

Why don't you put your different inputs format in an object like :

{
  "type": 1, // the type of your input, use it to parse it correctly
  "data": "your data here"'

skofo

unread,
Aug 16, 2022, 5:21:45 AM8/16/22
to meetecho-janus
Sure, we considered that and that would definitely be a simple solution. Consider my question more of a "Is this possible?" as I think multiple video or audio streams per peer connection is possible?

Lorenzo Miniero

unread,
Aug 16, 2022, 5:43:00 AM8/16/22
to meetecho-janus
You can only have one data channel per PeerConnection. In multistream VideoRoom, you'll get different subscribers as different labels (label = participant ID), but you have to explicitly subscribe as you do for audio and video.

L.

skofo

unread,
Aug 17, 2022, 2:53:31 AM8/17/22
to meetecho-janus
Alright, thanks for the info! :) 
Reply all
Reply to author
Forward
0 new messages