From 0fff9a8d58127295986c8a0343c38a40a0f82e04 Mon Sep 17 00:00:00 2001 From: ChristopheI Date: Thu, 10 Aug 2023 11:03:50 +0200 Subject: [PATCH] Fix Data Channel Open Message: Protocol was missing and ChannelType was hardcoded. Not sure that all ChannelType are really supported --- src/net/WebRTC/RTCDataChannel.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/net/WebRTC/RTCDataChannel.cs b/src/net/WebRTC/RTCDataChannel.cs index 04b1ec27e..e9e253287 100644 --- a/src/net/WebRTC/RTCDataChannel.cs +++ b/src/net/WebRTC/RTCDataChannel.cs @@ -202,11 +202,26 @@ public void send(byte[] data) /// internal void SendDcepOpen() { + byte type = (byte)DataChannelTypes.DATA_CHANNEL_RELIABLE; + if (!ordered) + { + type += (byte)DataChannelTypes.DATA_CHANNEL_RELIABLE_UNORDERED; + } + if (maxPacketLifeTime > 0) + { + type += (byte)DataChannelTypes.DATA_CHANNEL_PARTIAL_RELIABLE_TIMED; + } + else if(maxRetransmits > 0) + { + type += (byte)DataChannelTypes.DATA_CHANNEL_PARTIAL_RELIABLE_REXMIT; + } + var dcepOpen = new DataChannelOpenMessage() { MessageType = (byte)DataChannelMessageTypes.OPEN, - ChannelType = (byte)DataChannelTypes.DATA_CHANNEL_RELIABLE_UNORDERED, - Label = label + ChannelType = (byte)type, + Label = label, + Protocol = protocol, }; lock (this)