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

akonsu akonsu at gmail.com
Fri Sep 20 20:54:56 CEST 2013


thanks!

how to implement timeout callback manually? if I had receive then I would
just use timeout clause there, but with the handler I do not know...

I have doubts about validity of my question on the erlang list.  I later
realised that there is no problem receiving messages in my handler from my
upstream process, I can do it fast enough and shove everything to the
response. my real problem is to determine if the http client is reading
fast enough from the response...


2013/9/20 Loïc Hoguin <essen at ninenines.eu>

> 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<http://lists.ninenines.eu:81/listinfo/extend>
>>
>>
>
> --
> Loďc Hoguin
> Erlang Cowboy
> Nine Nines
> http://ninenines.eu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20130920/32352505/attachment.html>


More information about the Extend mailing list