Forum: NGINX WebSockets - connection keeps closing after 1 minute

Posted by WGH (Guest)
on 2013-02-20 16:58
(Received via mailing list)
Hello!

My WebSocket connections keep closing after precisely one minute.
The configuration is the same as provided in that commit comment.
http://trac.nginx.org/nginx/changeset/5073/nginx

Direct connections to the server (without intermediate nginx) happily 
live
for many hours.

What option should I change to fix that?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,236382,236382#msg-236382
Posted by Maxim Dounin (Guest)
on 2013-02-20 17:07
(Received via mailing list)
Hello!

On Wed, Feb 20, 2013 at 10:57:40AM -0500, WGH wrote:

> Hello!
>
> My WebSocket connections keep closing after precisely one minute.
> The configuration is the same as provided in that commit comment.
> http://trac.nginx.org/nginx/changeset/5073/nginx
>
> Direct connections to the server (without intermediate nginx) happily live
> for many hours.
>
> What option should I change to fix that?

There is proxy_read_timeout (http://nginx.org/r/proxy_read_timeout)
which as well applies to WebSocket connections.  You have to bump
it if your backend do not send anything for a long time.
Alternatively, you may configure your backend to send websocket
ping frames periodically to reset the timeout (and check if the
connection is still alive).

--
Maxim Dounin
http://nginx.com/support.html
Posted by WGH (Guest)
on 2013-02-20 17:17
(Received via mailing list)
Maxim Dounin Wrote:
-------------------------------------------------------
> There is proxy_read_timeout (http://nginx.org/r/proxy_read_timeout)
> which as well applies to WebSocket connections.  You have to bump
> it if your backend do not send anything for a long time.
> Alternatively, you may configure your backend to send websocket
> ping frames periodically to reset the timeout (and check if the
> connection is still alive).

Thanks, raising the timeout resolved the problem.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,236382,236386#msg-236386
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.