diff options
author | Loïc Hoguin <[email protected]> | 2016-08-29 12:39:49 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-29 12:40:03 +0200 |
commit | c807880f7ac73f813b2660ea81a00f7712a4e793 (patch) | |
tree | ba1d09e9b177f230665a80513b33fbd532000ce4 /archives/extend/attachments/20130820 | |
parent | b1df25a7d9cda697513650659b781b55b40898f8 (diff) | |
download | ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.tar.gz ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.tar.bz2 ninenines.eu-c807880f7ac73f813b2660ea81a00f7712a4e793.zip |
Add old mailing list archives
Diffstat (limited to 'archives/extend/attachments/20130820')
-rw-r--r-- | archives/extend/attachments/20130820/b203ebe2/attachment.html | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/archives/extend/attachments/20130820/b203ebe2/attachment.html b/archives/extend/attachments/20130820/b203ebe2/attachment.html new file mode 100644 index 00000000..43c2369f --- /dev/null +++ b/archives/extend/attachments/20130820/b203ebe2/attachment.html @@ -0,0 +1,32 @@ +<tt> +<div dir="ltr">This is exactly the sort of thing gen_event is for. I would make each server process register a handler at startup using gen_event:add_sup_handler() and then have the handle_event callback simply relay the event to the server processes. Yes, gproc can do this, but why incur its extra features and overhead?<div class="gmail_extra"><br> +<br><br><div class="gmail_quote">On Sat, Aug 17, 2013 at 3:10 AM, Lo�c Hoguin <span dir="ltr"><<a href="mailto:[email protected]" target="_blank">[email protected]</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br> +<div class="im">On 08/17/2013 10:00 AM, Bin Wang wrote:<br><br> +<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br> +Hi,<br><br> +<br><br> +I'm new to ranch. In my application, I need to send some message to<br><br> +all connections. So I'd like to know can I get all connections from<br><br> +ranch, so I could use Transport:send to send them, or I must manage<br><br> +all the created connections by myself? Or is there any other better<br><br> +way?<br><br> +</blockquote><br> +<br></div><br> +The best way to do that is on your end, using gproc properties. When the connection is accepted, register the process with the property and use the property to send messages to all processes. You don't need to unregister when the connection ends, gproc does that automatically.<br><br> +<br> +<br><br> +The hackish way to do that would be to call supervisor:which_children on the ranch_conns_sup supervisor of your listener, but that will slow down the accepting of new connections, so don't do this if you need high accept rates.<span class="HOEnZb"><font color="#888888"><br><br> +<br> +<br><br> +-- <br><br> +Lo�c Hoguin<br><br> +Erlang Cowboy<br><br> +Nine Nines<br><br> +<a href="http://ninenines.eu" target="_blank">http://ninenines.eu</a></font></span><div class="HOEnZb"><div class="h5"><br><br> +______________________________<u></u>_________________<br><br> +erlang-questions mailing list<br><br> +<a href="mailto:[email protected]" target="_blank">[email protected]</a><br><br> +<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br><br> +</div></div></blockquote></div><br></div></div><br> + +</tt> |