diff options
Diffstat (limited to 'archives/extend/2013-August/000226.html')
-rw-r--r-- | archives/extend/2013-August/000226.html | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/archives/extend/2013-August/000226.html b/archives/extend/2013-August/000226.html new file mode 100644 index 00000000..4fcc1620 --- /dev/null +++ b/archives/extend/2013-August/000226.html @@ -0,0 +1,102 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<HTML> + <HEAD> + <TITLE> [99s-extend] [erlang-questions] How to broadcaset with ranch? + </TITLE> + <LINK REL="Index" HREF="index.html" > + <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20%5Berlang-questions%5D%20%20How%20to%20broadcaset%20with%20ranch%3F&In-Reply-To=%3CCAPGJuCaYJnOn-Hq_GgQZV2pxmaUwCxbS372dapbnQiOZ8vWC%3Dw%40mail.gmail.com%3E"> + <META NAME="robots" CONTENT="index,nofollow"> + <style type="text/css"> + pre { + white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */ + } + </style> + <META http-equiv="Content-Type" content="text/html; charset=us-ascii"> + <LINK REL="Previous" HREF="000225.html"> + + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] [erlang-questions] How to broadcaset with ranch?</H1> + <B>Sean Cribbs</B> + <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20%5Berlang-questions%5D%20%20How%20to%20broadcaset%20with%20ranch%3F&In-Reply-To=%3CCAPGJuCaYJnOn-Hq_GgQZV2pxmaUwCxbS372dapbnQiOZ8vWC%3Dw%40mail.gmail.com%3E" + TITLE="[99s-extend] [erlang-questions] How to broadcaset with ranch?">seancribbs at gmail.com + </A><BR> + <I>Wed Aug 21 05:18:19 CEST 2013</I> + <P><UL> + <LI>Previous message: <A HREF="000225.html">[99s-extend] How to broadcaset with ranch? +</A></li> + + <LI> <B>Messages sorted by:</B> + <a href="date.html#226">[ date ]</a> + <a href="thread.html#226">[ thread ]</a> + <a href="subject.html#226">[ subject ]</a> + <a href="author.html#226">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>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? + + +On Sat, Aug 17, 2013 at 3:10 AM, Loïc Hoguin <<A HREF="https://lists.ninenines.eu/listinfo/extend">essen at ninenines.eu</A>> wrote: + +><i> On 08/17/2013 10:00 AM, Bin Wang wrote: +</I>><i> +</I>>><i> Hi, +</I>>><i> +</I>>><i> I'm new to ranch. In my application, I need to send some message to +</I>>><i> all connections. So I'd like to know can I get all connections from +</I>>><i> ranch, so I could use Transport:send to send them, or I must manage +</I>>><i> all the created connections by myself? Or is there any other better +</I>>><i> way? +</I>>><i> +</I>><i> +</I>><i> The best way to do that is on your end, using gproc properties. When the +</I>><i> connection is accepted, register the process with the property and use the +</I>><i> property to send messages to all processes. You don't need to unregister +</I>><i> when the connection ends, gproc does that automatically. +</I>><i> +</I>><i> The hackish way to do that would be to call supervisor:which_children on +</I>><i> the ranch_conns_sup supervisor of your listener, but that will slow down +</I>><i> the accepting of new connections, so don't do this if you need high accept +</I>><i> rates. +</I>><i> +</I>><i> -- +</I>><i> Loïc Hoguin +</I>><i> Erlang Cowboy +</I>><i> Nine Nines +</I>><i> <A HREF="http://ninenines.eu">http://ninenines.eu</A> +</I>><i> +</I>><i> ______________________________**_________________ +</I>><i> erlang-questions mailing list +</I>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">erlang-questions at erlang.org</A> +</I>><i> <A HREF="http://erlang.org/mailman/**listinfo/erlang-questions<http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/**listinfo/erlang-questions<http://erlang.org/mailman/listinfo/erlang-questions</A>> +</I>><i> +</I>-------------- next part -------------- +An HTML attachment was scrubbed... +URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20130820/b203ebe2/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20130820/b203ebe2/attachment.html</A>> +</PRE> + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000225.html">[99s-extend] How to broadcaset with ranch? +</A></li> + + <LI> <B>Messages sorted by:</B> + <a href="date.html#226">[ date ]</a> + <a href="thread.html#226">[ thread ]</a> + <a href="subject.html#226">[ subject ]</a> + <a href="author.html#226">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> |