Production and research there is the need for long connection through Nginx Proxy, we know that the default Nginx only supports short connections, with long connections need to be configured separately
One
The WebSocket protocol provides a Web application that creates a two-way communication that supports both server and client. As part of the HTML5, Websock makes it easier to provide a simpler method than the way it was previously available. Most of today's browsers support Websock, including chrome,firefox,internet browsers, Opera, and Safari, and a growing number of server application frameworks are also beginning to support Websock.
The WebSocket protocol is different from the HTTP protocol, but the WebSocket handshake is HTTP compatible and updates the connection from HTTP to upgrade with the TTP Websock method. This allows WebSocket applications to more easily fit into existing infrastructures. For example, Websock apps can communicate using standard HTTP ports 80 and 443.
a WebSocket application keeps A long?running connection open between the client and the Serv Er, facilitating the development of real?time applications. This http Upgrade mechanism by using " THE  Upgrade
and Connection
Headers. "To update the connection from HTTP to WebSocket. There is some challenges, a reverse proxy server faces in supporting WebSocket. One is WebSocket is a hop-by-hop (hop) protocol,  SO when a proxy server intercepts an Upgrade request from a client it needs to send It own Upgrade request to the backend server, including the appropriate headers. Also, the WebSocket connection is a long connection, rather than a typical short connection when using HTTP, that is, the reverse proxy server needs to keep these connections open when they are idle, rather than shutting them down.
NGINX supports WebSocket by allowing a tunnel to BES set up between a client and a backend server. For Nginx sending upgrade requests from client to backend server, the and Upgrade
Connection
headers must be set explicitly, as in this example:
location/wsapp/{ Proxy_pass http://wsbackend; Proxy_http_version 1.1; Proxy_set_header Upgrade $http _upgrade; Proxy_set_header Connection "Upgrade";}
Once This is do, NGINX deals with this as a WebSocket connection.
Two, give a chestnut.
Reference: https://www.nginx.com/blog/websocket-nginx/
015_nginx as the WebSocket proxy setting