Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disconnect via keepalive, invoke DispatchMessageQueue to handle received messages #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion NativeWebSocket/Assets/WebSocket/WebSocket.cs
Original file line number Diff line number Diff line change
@@ -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,13 +674,15 @@ public async Task Receive()
// string message = reader.ReadToEnd();
// OnMessage?.Invoke(this, new MessageEventArgs(message));
//}
DispatchMessageQueue();
}
else if (result.MessageType == WebSocketMessageType.Binary)
{
lock (IncomingMessageLock)
{
m_MessageList.Add(ms.ToArray());
}
DispatchMessageQueue();
}
else if (result.MessageType == WebSocketMessageType.Close)
{
4 changes: 2 additions & 2 deletions NativeWebSocket/Assets/package.json
Original file line number Diff line number Diff line change
@@ -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": {