summaryrefslogblamecommitdiffstats
path: root/archives/extend/2013-August/000225.html
blob: bd4c5de581235720574dd5b24ef91f75951bece4 (plain) (tree)




















































































                                                                                                                                                                                           
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
 <HEAD>
   <TITLE> [99s-extend] 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%20How%20to%20broadcaset%20with%20ranch%3F&In-Reply-To=%3C520F3001.5010504%40ninenines.eu%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="000224.html">
   <LINK REL="Next"  HREF="000226.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[99s-extend] How to broadcaset with ranch?</H1>
    <B>Lo&#239;c Hoguin</B> 
    <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20How%20to%20broadcaset%20with%20ranch%3F&In-Reply-To=%3C520F3001.5010504%40ninenines.eu%3E"
       TITLE="[99s-extend] How to broadcaset with ranch?">essen at ninenines.eu
       </A><BR>
    <I>Sat Aug 17 10:10:41 CEST 2013</I>
    <P><UL>
        <LI>Previous message: <A HREF="000224.html">[99s-extend] How to broadcaset with ranch?
</A></li>
        <LI>Next message: <A HREF="000226.html">[99s-extend] [erlang-questions]  How to broadcaset with ranch?
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#225">[ date ]</a>
              <a href="thread.html#225">[ thread ]</a>
              <a href="subject.html#225">[ subject ]</a>
              <a href="author.html#225">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>On 08/17/2013 10:00 AM, Bin Wang wrote:
&gt;<i> Hi,
</I>&gt;<i>
</I>&gt;<i> I'm new to ranch. In my application, I need to send some message to
</I>&gt;<i> all connections. So I'd like to know can I get all connections from
</I>&gt;<i> ranch, so I could use Transport:send to send them, or I must manage
</I>&gt;<i> all the created connections by myself? Or is there any other better
</I>&gt;<i> way?
</I>
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.

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.

-- 
Lo&#239;c Hoguin
Erlang Cowboy
Nine Nines
<A HREF="http://ninenines.eu">http://ninenines.eu</A>

</PRE>

<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI>Previous message: <A HREF="000224.html">[99s-extend] How to broadcaset with ranch?
</A></li>
	<LI>Next message: <A HREF="000226.html">[99s-extend] [erlang-questions]  How to broadcaset with ranch?
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#225">[ date ]</a>
              <a href="thread.html#225">[ thread ]</a>
              <a href="subject.html#225">[ subject ]</a>
              <a href="author.html#225">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>