[99s-extend] timeouts and slow clients in cowboy loop handler

Loïc Hoguin essen at ninenines.eu
Fri Sep 20 20:50:57 CEST 2013


Loop handlers close after a while regardless of what you send, it only 
checks what the client sends. The best way for you would be to disable 
that timeout and handle it manually.

As for the second question, I'm still reading the thread on 
erlang-questions but I've seen some good ideas about timestamps so far.

On 09/20/2013 08:47 PM, akonsu wrote:
> Hi,
>
> I am using loop handler and I stream from it:
>
> info({stream, Part}, Req, S) ->
>      ok = cowboy_req:chunk(Part, Req),
>      {loop, Req, S, hibernate};
>
> I have two questions:
>
> 1. on timeouts cowboy sends 204 No Content. In my case it is not the
> right response because I may have already sent some data. Is there a way
> to send a custom response?
>
> 2. how to check if the client is too slow and is not reading the
> response stream fast enough? If this happens, then I need to disconnect.
>
> I can live without 1. but I need to figure out 2. Please help.
>
> thank you!
> Konstantin
>
>
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> http://lists.ninenines.eu:81/listinfo/extend
>


-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu



More information about the Extend mailing list