Hi!<div><br></div><div>All names registered for a process will be cleaned up when the process exits. Unless you need to switch between receiving broadcasted messages and not mid-flight there is no need to unregister the property/name manually. If you're looking for the same effect in the middle of the lifetime of a process the gproc:goodbye function can be used to unregister all names.</div>
<div><br></div><div>MVH Magnus<br><br><div class="gmail_quote">On Sat, Apr 7, 2012 at 4:56 PM, Barco You <span dir="ltr"><<a href="mailto:barcojie@gmail.com">barcojie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
thank you very much you all.<br><br>But next question: how can I delete a client from the broadcast pool, because the gproc has only the API to unregister a process by "key" - unreg(Key) - and can not find unregister by Pid().<br>

<br>Best regards,<br>Barco<div class="HOEnZb"><div class="h5"><br><br><div class="gmail_quote">On Sat, Apr 7, 2012 at 10:26 PM, Magnus Klaar <span dir="ltr"><<a href="mailto:magnus.klaar@gmail.com" target="_blank">magnus.klaar@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi!<br><br>Insert a function clause to filter out these messages to the websocket_info/3 function. You are already including the process-id of the sending process in your broadcast/1 function, we can use that to filters out messages sent from self(). In practice, you _may_ want to use a logical id to perform this filtering rather than reusing the process-id of the connection that happened to be connected to a client at the time.<div>


<br></div><div>websocket_info({Pid, {_Module, ?BC}, _Msg}, Req, State) when Pid =:= self() -></div><div>   {ok, Req, State, hibernate};</div><div><div><div>websocket_info({_Pid, {_Module, ?BC}, Msg}, Req, State) -></div>


<div>    {reply, {text, <<Msg>>}, Req, State, hibernate}.</div></div></div><div><br>MVH Magnus</div><div><div><div><br><div class="gmail_quote">On Sat, Apr 7, 2012 at 4:13 PM, Barco You <span dir="ltr"><<a href="mailto:barcojie@gmail.com" target="_blank">barcojie@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Magnus,<br><br>Thank you very much!<br><br>Then, if broadcasting to all other clients except self, how to do it with gproc?<br>


<br>Regards,<br>Barco<div><div><br></div></div></blockquote></div></div>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div>