Closed srinivasbakki closed 1 year ago
Hi @srinivasbakki, one way to do that would be to negotiate out-of-bands. You wouldn't have to use the ondatachannel
event at all. You can just wait for the state to reach open
. You'll have to use the negotiated parameter. This would require your viewer to know the channel names beforehand.
For example:
dataChannelA = peerConnection.createDataChannel(“channelA”, {negotiated: true, id: 1};
dataChannelB = peerConnection.createDataChannel(“channelB”, {negotiated: true, id: 2};
Closing assuming answered. Feel free to reach out to us with further questions
I need to send two kinds of data and hence need two data channels. How can i create two channels. I did peerConnection.createDatachannel with two different names. However There's only peerConnection.ondatachannel event handler. How do i register events with two different data channels ?