-
After playing around with the p2p connection using the I was expecting to use it like this this.DataChannel = await this.PeerConnection.createDataChannel(myLabel);
this.DataChannel.onmessage += (RTCDataChannel dc, DataChannelPayloadProtocols protocol, byte[] data) =>
{
// message handling
}; But to my surprise, this event never fired. After looking into it i tried subscribing to the My questions here are, why are there two I would really appreciate to get a deeper understanding on how data channels are implemented here, thanks. To see what i am talking about you can start the example project More weird behaviour: this.DataChannel = await this.PeerConnection.createDataChannel(myLabel);
// only gets set once. BEFORE second data channel exists
this.DataChannel.onmessage += (RTCDataChannel dc, DataChannelPayloadProtocols protocol, byte[] data) =>
{
// message handling
};
this.PeerConnection.ondatachannel += (RTCDataChannel dataChannel) =>
{
// this gets called AFTER setting onmessage listener
bool same = this.DataChannel == dataChannel; // is always false
this.DataChannel = dataChannel;
}; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Sorry, not sure if I'm following correctly, since I didn't observe duplicated data channel behavior, they are correctly "dc1" (from JS rtcpeer) and "test" (from sipsorcery rtcpeer). |
Beta Was this translation helpful? Give feedback.
Sorry, not sure if I'm following correctly, since I didn't observe duplicated data channel behavior, they are correctly "dc1" (from JS rtcpeer) and "test" (from sipsorcery rtcpeer).