Hi Victor,

Socket handling for the TCP sockets is done by Twisted inside its TCP core,
so you would have to look there to see what sort of options they set when
opening a HTTP/WS connection handler. I personally have not seen too many
issues with WebSocket timeouts, presumably as Daphne implements the
WebSocket PING protocol to keep data flowing down the socket at regular
intervals.

Andrew

On Fri, May 12, 2017 at 10:52 AM, Victor Porton <[email protected]> wrote:

> About https://github.com/django/channels
>
> In the past I dealt with another Python WebSocket engine (unrelated to
> Django). The connection was breaking after a timeout. I solved this problem
> adding:
>
> sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
>
> sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPIDLE, 150)
>
> sock.setsockopt(socket.SOL_TCP, socket.TCP_KEEPINTVL, 150)
>
>
> in the connection handler.
>
>
> I strongly suspect that this is also needed for proper working of Django
> Channels.
>
>
> Where can I hook this code up? (Where can I get the underlying Unix
> socket?)
>
>
> Also probably these three sock.setsockopt calls should be added into the
> default constructor for a WebSocket. What do you think? We can provide a
> boolean argument, which when set to the non-default value would eliminate
> these extra calls. When it set to default value, should call these
> three sock.setsockopt (it should be the default, because breaking WS after
> a timeout is usually bad).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-developers/df05a571-7ca1-4e0c-9bfe-
> 6c7721a3285c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/df05a571-7ca1-4e0c-9bfe-6c7721a3285c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFwN1urf7ScxjnHFCzx8%2BjahKd_SokVB%2BiCWG9L1s7ongWt13w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to