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

Loïc Hoguin essen at ninenines.eu
Mon Sep 16 19:06:32 CEST 2013


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
>
> 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



More information about the Extend mailing list