1
votes

I use Signalr v2.0.2 with JS-client (WebSocket transport) on my ASP.NET 4.5 site and IIS-8 (WebSockets Enabled). After load testing (using Selenium) I can see next error in console of any browser (*** is our domain name).

[20:23:46 GMT+0400 (Russian Standard Time)] SignalR: Connecting to websocket endpoint 'wss:///connect?transport=webSockets&connection…6GkCoU%3D&State=1&connectionData=%5B%7B%22name%22%3A%22chat%22%7D%5D&tid=1'. projects-FK0ZHh5_zUo_6I0Z725jUg2.js?ver=7.627:54 WebSocket connection to 'wss:///signalr/connect?transport=webSockets&connection…6GkCoU%3D&State=1&connectionData=%5B%7B%22name%22%3A%22chat%22%7D%5D&tid=1' failed: Error during WebSocket handshake: Unexpected response code: 502

I always get this error even after finished load testing. I never saw this error and I don't know reason of this. It can be resolved only application restart.

1

1 Answers

2
votes

Check this out: http://www.infoq.com/articles/Web-Sockets-Proxy-Servers

This is almost certainly due to not using https (SSL). Websocket over plain http is vulnerable to proxies in the middle (often transparent) operating at the http layer breaking the connection.

This is common on cellular networks, or office networks that may use multiple wireless connections with a proxy that spreads the http requests across connections.

The only way to avoid this is to use SSL all the time - this gives websocket the best chance of working.