[99s-extend] how to send a message to all connections in cowboy

akonsu akonsu at gmail.com
Mon Sep 16 19:14:24 CEST 2013


thanks. Suppose my external process is registered and has a name, so I can
discover it by name from my cowboy request handler. when my cowboy handler
is invoked, can I just send the handler's process ID to the external
process? the question is then how does the external process know that the
http client has disconnected so that it can stop sending data to it.


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

> On 09/16/2013 03:50 PM, akonsu wrote:
>
>> Hello,
>>
>> this is somewhat similar to what someone else has asked:
>> http://lists.ninenines.eu:81/**archives/extend/2013-August/**000224.html<http://lists.ninenines.eu:81/archives/extend/2013-August/000224.html>
>>
>> I am new to cowboy, I have a process that runs alongside a cowboy server
>> and this process needs to periodically send text to all http clients
>> connected to the cowboy server. My goal is to have a streaming
>> connection for each http client so that I could stream text to them from
>> my process. how is this done?
>>
>
> Same answer really. You need some kind of process registry, like gproc
> properties for example, that will store all Pids and allow you to send a
> message to all of them.
>
> On init, register the process, and then handle the incoming message when
> it arrives.
>
> --
> 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/20130916/f55d10f5/attachment.html>


More information about the Extend mailing list