Tornado WebSocket closes once per minute

I use the Closure client side and the Tornado server. I am creating a socket:

this.socket = goog.net.WebSocket(true) 

and then open it:

 this.socket.open(theSocketUrl) 

Each works fine, including the messages being transmitted. However, once a minute (every 60-61 seconds), the socket closes and then opens again. There are no errors on the server side, and the Closure socket error event is not triggered.

I added an entry to the tornado, and something seems to call on_connection_close (), which then calls the on_close () socket method. The close () method itself is not called.

Any idea why this could be happening?

+6
source share
1 answer

Are you using nginx or some other reverse proxy in front of the tornado server? I saw this when the proxy timed out and then nginx closes the connection causing the behavior you see.

You can change proxy_send_timeout and proxy_read_timeout in nginx to prevent this. Just make sure that when editing proxy.conf you include it from the main nginx.conf .

+3
source

Source: https://habr.com/ru/post/944137/


All Articles