[99s-extend] Big body via REST

Wu Ray mjollnir.ray at gmail.com
Mon Mar 18 10:21:13 CET 2013


Get it. When something happed with client or network, socket will
broke, and Transport:send/2 will return {error, closed}, etc.

So, just make sure each Transport:send(...) is correct, like this:
ok = Transport:send(Socket, Data),

the rest will be handle by cowboy.

On Mon, Mar 18, 2013 at 4:39 PM, Wu Ray <mjollnir.ray at gmail.com> wrote:
>>> Hi list,
>>>
>>> how properly send big response (hundreds of megabytes) via REST callback? As far as I can see REST handler in cowboy handles special case for callback functions (cowboy_rest.erl, line 844): {stream, StreamFun} - is it right place for stream big response from SQL database?
>>>
>>Hey,
>>
>>If you know the size, reply with {stream, Size, StreamFun}, otherwise
>>{stream, StreamFun}, with StreamFun the function that will send all the
>>data to the socket.
>
> Hi, guys,
> my problem is, if the client is closed or network broken, how to
> handle these situation with cowboy.



More information about the Extend mailing list