[99s-extend] how to send a message to all connections in cowboy
Loïc Hoguin
essen at ninenines.eu
Mon Sep 16 19:19:59 CEST 2013
Monitors.
But really gproc does all that for you and is already well tested.
https://github.com/esl/gproc
On 09/16/2013 07:14 PM, akonsu wrote:
> 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 <mailto: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
>
>
--
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu
More information about the Extend
mailing list