yea i finally backtracked more through the code and realized you can just do<div><br></div><div> sockjs_session:send(iolist_to_binary([Msg]),{sockjs_session,{P,empty}})</div><div><br></div><div> as an API call to a gen_server:cast() call. I am gonna throw this into a spawn(fun() -> ) to get as close to "broadcast" as possible unless there is negligible gain in doing this since its an async call anyway.</div>
<div><br></div><div>-A<br><div><br></div><div><br><br><div class="gmail_quote">On Tue, Apr 10, 2012 at 7:09 PM, Tilman Holschuh <span dir="ltr"><<a href="mailto:tilman.holschuh@gmail.com">tilman.holschuh@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">And this doesn't work for you?<br>
<br>
<a href="https://github.com/sockjs/sockjs-erlang/blob/master/src/sockjs_session.erl#L66" target="_blank">https://github.com/sockjs/<u></u>sockjs-erlang/blob/master/src/<u></u>sockjs_session.erl#L66</a><br>
<br>
It's a cast and you can supply the pid (just wondering why he explicitly returns ok but that doesn't matter).<br>
<br>
Cheers<br>
- Tilman<div class="im"><br>
<br>
On 12-04-10 03:01 PM, AD wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
the gen_server is part of the sockjs server and i was trying to not<br>
modify/fork his code and leverage what is already there. Currently he uses<br>
a handle_call() so was looking at handling it outside his code.<br>
<br>
-AD<br>
<br>
On Tue, Apr 10, 2012 at 4:18 PM, Tilman Holschuh<br>
<<a href="mailto:tilman.holschuh@gmail.com" target="_blank">tilman.holschuh@gmail.com</a>><u></u>wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
On 12-04-10 12:37 PM, AD wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a situation where i am trying to handle a case where I am using<br>
sockjs and need to send a message to each sockjs session_server (which is<br>
a<br>
gen_server). I am using gproc() but I cant simply do a gproc_send() b/c<br>
the message ends up in handle_info() instead of properly in handle_call().<br>
I have managed to work this out, when receiving a message from rabbitmq i<br>
do a gproc:lookup_pids() and then loop through each pid and do a<br>
gen_server:call(PID,Message). The issue is this is a linear process, is<br>
there a way to handle sending gen_server:call() to all the processes<br>
concurrently ?<br>
<br>
</blockquote>
<br>
Do you need a response from the gen_server:call? If not you could just use<br>
a cast instead. Something like:<br>
<br>
[gen_server:cast(Pid, Message) || Pid<- gproc:lookup_pids()]<br>
<br>
<br>
Cheers<br>
- Tilman<br>
<br></div>
______________________________<u></u>**_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/**listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/**<u></u>listinfo/erlang-questions</a><<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http<u></u>://erlang.org/mailman/<u></u>listinfo/erlang-questions</a>><br>
<br>
</blockquote>
<br>
</blockquote>
</blockquote></div><br></div></div>