From 8d1270f247a179b117459a24fe5b756cf7783337 Mon Sep 17 00:00:00 2001 From: Tossrock Date: Fri, 22 Nov 2024 15:45:36 -0800 Subject: [PATCH 1/2] Update WebSocket.cs Fix keepalive interval, actually invoke the OnReceive code for messages. --- NativeWebSocket/Assets/WebSocket/WebSocket.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NativeWebSocket/Assets/WebSocket/WebSocket.cs b/NativeWebSocket/Assets/WebSocket/WebSocket.cs index 503cf43..d58db15 100644 --- a/NativeWebSocket/Assets/WebSocket/WebSocket.cs +++ b/NativeWebSocket/Assets/WebSocket/WebSocket.cs @@ -458,7 +458,8 @@ public async Task Connect() m_CancellationToken = m_TokenSource.Token; m_Socket = new ClientWebSocket(); - + m_Socket.Options.KeepAliveInterval = TimeSpan.Zero; + foreach (var header in headers) { m_Socket.Options.SetRequestHeader(header.Key, header.Value); @@ -673,6 +674,7 @@ public async Task Receive() // string message = reader.ReadToEnd(); // OnMessage?.Invoke(this, new MessageEventArgs(message)); //} + DispatchMessageQueue(); } else if (result.MessageType == WebSocketMessageType.Binary) { @@ -680,6 +682,7 @@ public async Task Receive() { m_MessageList.Add(ms.ToArray()); } + DispatchMessageQueue(); } else if (result.MessageType == WebSocketMessageType.Close) { From 63e926590878d70c5af6da4cad958a6801b27b41 Mon Sep 17 00:00:00 2001 From: Tossrock Date: Fri, 22 Nov 2024 15:51:29 -0800 Subject: [PATCH 2/2] bump version --- NativeWebSocket/Assets/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NativeWebSocket/Assets/package.json b/NativeWebSocket/Assets/package.json index 8846f6a..9da4abb 100644 --- a/NativeWebSocket/Assets/package.json +++ b/NativeWebSocket/Assets/package.json @@ -1,6 +1,6 @@ { - "name": "com.endel.nativewebsocket", - "version": "1.1.4", + "name": "com.Tossrock.nativewebsocket", + "version": "1.1.5", "description": "WebSocket client for Unity - with no external dependencies (WebGL, Native, Android, iOS, UWP).", "license": "Apache 2.0", "repository": {