We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ffac796 + 1140c96 commit 37309f8Copy full SHA for 37309f8
src/Nullinside.Api.Common/Extensions/WebSocketExtensions.cs
@@ -31,8 +31,9 @@ public static class WebSocketExtensions {
31
var data = new ArraySegment<byte>(new byte[1024]);
32
response = await webSocket.ReceiveAsync(data, cancelToken);
33
fullMessage.AddRange(data);
34
- } while (null == response.CloseStatus);
+ } while (null == response.CloseStatus && !response.EndOfMessage);
35
36
- return Encoding.ASCII.GetString(fullMessage.ToArray());
+ // Remove the null character from the end of the string, this happens when the buffer is only partially filled.
37
+ return Encoding.ASCII.GetString(fullMessage.ToArray()).TrimEnd('\0');
38
}
39
0 commit comments