From 6dca73bd2ef2a373eccc4a6187b921519059631f Mon Sep 17 00:00:00 2001 From: Alexis Nowikowski Date: Fri, 27 Sep 2019 21:29:12 +0200 Subject: [PATCH 1/2] Added void WebSocketSession.SendRawData(IList> segments) method --- Protocols/WebSocket/WebSocketSession.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Protocols/WebSocket/WebSocketSession.cs b/Protocols/WebSocket/WebSocketSession.cs index 3d28d9776..7422ad165 100644 --- a/Protocols/WebSocket/WebSocketSession.cs +++ b/Protocols/WebSocket/WebSocketSession.cs @@ -474,6 +474,15 @@ bool IWebSocketSession.TrySendRawData(byte[] data, int offset, int length) return base.TrySend(new ArraySegment(data, offset, length)); } + /// + /// Sends raw data segments. + /// + /// The segments. + internal void SendRawData(IList> segments) + { + base.Send(segments); + } + /// /// Tries the send raw data segments. /// From 32740c2deddfd63e45fa70f6d263353325e53e9c Mon Sep 17 00:00:00 2001 From: Alexis Nowikowski Date: Fri, 27 Sep 2019 21:29:24 +0200 Subject: [PATCH 2/2] WebSocketServer.Broadcast: use SendRawData instead if TrySendRawData --- Protocols/WebSocket/WebSocketServer.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Protocols/WebSocket/WebSocketServer.cs b/Protocols/WebSocket/WebSocketServer.cs index e825210e0..75c554f84 100644 --- a/Protocols/WebSocket/WebSocketServer.cs +++ b/Protocols/WebSocket/WebSocketServer.cs @@ -127,7 +127,7 @@ public WebSocketServer(IEnumerable> subProtocols public WebSocketServer(ISubProtocol subProtocol) : this(new List> { subProtocol }) { - + } /// @@ -244,7 +244,7 @@ private bool SetupSubProtocols(IServerConfig config) { string originalProtocolName = protocolConfig.Name; string protocolName; - + ISubProtocol subProtocolInstance; if (!string.IsNullOrEmpty(originalProtocolName)) @@ -328,7 +328,7 @@ private bool SetupSubProtocols(IServerConfig config) return false; } } - + return true; } @@ -652,7 +652,7 @@ protected override bool SetupCommands(Dictionary> { new HandShake(), - new Text(), + new Text(), new Binary(), new Close(), new Ping(), @@ -772,7 +772,8 @@ private void SendRawDataToSession(object state) try { - sendOk = session.TrySendRawData(param.Data); + session.SendRawData(param.Data); + sendOk = true; } catch (Exception e) {