- nginx support for WebSocket, WSS protocol support See official documentation: http://nginx.org/en/docs/http/websocket.html
Nginx since Version 1.3 has started to support WebSocket and can do reverse proxy and load balancing for WebSocket applications. The
WebSocket differs from the HTTP protocol, but the handshake in WebSocket is compatible with the handshake in HTTP, which uses the Upgrade protocol header in HTTP to upgrade the connection from HTTP to WebSocket when the client sends over a connection:upgrade
Request header, Nginx is not known, so when the Nginx proxy server to intercept a client sent to the Upgrade
Request, you need to explicitly set , Connection
, , Upgrade
header information, and use 101 (Interchange Protocol) to return the response in the client and proxy server , and a tunnel is established between the backend servers to support WebSocket.
Of course, it is also important to note that WebSockets is still affected by the Nginx default of 60 seconds of proxy_read_timeout. This means that if you have a program that uses WebSockets but may not send any data for more than 60 seconds, you either need to increase the timeout or implement a ping message to keep in touch. There are additional benefits to using Ping's workaround to find out if the connection was accidentally closed.
- WebSocket Protocol: 5 minutes from beginner to proficient: http://www.cnblogs.com/chyingp/p/websocket-deep-in.html
- WebSocket Detailed Tutorial: https://www.cnblogs.com/jingmoxukong/p/7755643.html
- websocket issues to consider in use: 75810099
- springboot using websocket:81002396
WebSocket collection of good text