Error parsing handshake response during reconnect

See original GitHub issue

I’ve implemented Web Socket reconnection and it works fine for a while (i. e. if I disable wi-fi for 5 minutes or hibernate my laptop) but if I leave my mac book for an hour or so (it goes into sleeping mode I guess), SignalR doesn’t recover: it manages to connect but then gets a handshake error and then this cycle repeats again and again.

I reproduced this behaviour on Chrome on Mac and my colleague reproduced it on Chrome on Windows though he was not able to reproduce it on Edge. So it might be a browser-specific problem

Here’s a console output

[2019-01-06T11:29:15.846Z] Information: WebSocket connected to ws://api.gateio-demo.cryptolp.net/Liquidity?id=pylLwZAF0045nJxY-MJcTg.
HubConnection.js:552 Uncaught Error: Error parsing handshake response: Error: Expected a handshake response from the server.
at t.processHandshakeResponse (HubConnection.js:552)
at t.processIncomingData (HubConnection.js:489)
at t.connection.onreceive (HubConnection.js:179)
at WebSocket.i.onmessage (WebSocketTransport.js:238)
t.processHandshakeResponse @ HubConnection.js:552
t.processIncomingData @ HubConnection.js:489
connection.onreceive @ HubConnection.js:179
i.onmessage @ WebSocketTransport.js:238

Utils.js:358 [2019-01-06T11:29:31.696Z] Error: Connection disconnected with error 'Error: Error parsing handshake response: Error: Expected a handshake response from the server.'.
t.log @ Utils.js:358
t.stopConnection @ HttpConnection.js:714
transport.onclose @ HttpConnection.js:435
t.close @ WebSocketTransport.js:288
t.stop @ WebSocketTransport.js:274
(anonymous) @ HttpConnection.js:274
(anonymous) @ HttpConnection.js:125
(anonymous) @ HttpConnection.js:55
a @ HttpConnection.js:7
Promise.then (async)
l @ HttpConnection.js:24
(anonymous) @ HttpConnection.js:27
j @ HttpConnection.js:4
t.stop @ HttpConnection.js:234
t.processHandshakeResponse @ HubConnection.js:555
t.processIncomingData @ HubConnection.js:489
connection.onreceive @ HubConnection.js:179
i.onmessage @ WebSocketTransport.js:238

HubConnection.js:552 Uncaught (in promise) Error: Error parsing handshake response: Error: Expected a handshake response from the server.
at t.processHandshakeResponse (HubConnection.js:552)
at t.processIncomingData (HubConnection.js:489)
at t.connection.onreceive (HubConnection.js:179)
at WebSocket.i.onmessage (WebSocketTransport.js:238)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:27 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
BrennanConroycommented, Feb 2, 2019

No, depending on when the failure is internally the onclose may not be called but start will throw. We’ll look at fixing this in a future release.

1reaction
BrennanConroycommented, Feb 1, 2019

Looks like there is a bug in how we recommend doing the reconnect. The onclose callback is being called and at the same time connection.start() throws, so you get 2 reconnect attempts. The workaround for now would be to set a flag and check it in the catch and the onclose callback.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aspnet/signalr: Error parsing handshake response: TypeError
if response is missing that separator, will generare an Error. "Error parsing handshake response: Error: Message is incomplete.".
Read more >
ASP.NET Core SignalR connection troubleshooting
This section provides help with errors that can occur when trying to establish a connection to an ASP.NET Core SignalR hub. Response code...
Read more >
Cosmos DB: Invalid handshake
Hello, unable to connect to Azure Cosmos DB with Gremlin Console or Java Client 3.4.4: Invalid handshake response getStatus: 404 Not Found.
Read more >
Failed parsing handshake; end byte not precent in buffer (-1)
Using Python 3.2 and the MYSQL Connector for Windows, I get this error attempting to connect to a specific database. Ths code I'm...
Read more >
Resolved: SignalR Error: Failed To Complete Negotiation ...
NET Core applications. In the client application, I got the below error message while trying to receive the message from SignalR Hub(server).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found