ruby - How to broadcast or make connection in em-websocket? -


i using em-websocket make communication clients (may 2 or more users).

in introduction . https://github.com/igrigorik/em-websocket

i want modify simple echo server example achieve purpose.

but in example , handshake.path output show "/" .

i cannot know client .

is there have solution can know client source place , make broadcast message of them ?

i found answer in example.

https://github.com/igrigorik/em-websocket/blob/master/examples/multicast.rb

eventmachine::websocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) |ws| ws.onopen {     sid = @channel.subscribe { |msg| ws.send msg }     @channel.push "#{sid} connected!" ws.onmessage { |msg|     @channel.push "<#{sid}>: #{msg}" } ws.onclose {     @channel.unsubscribe(sid) } } end 

but still have problem that: how can send message specified clients?

(e.g.) 2 clients (no.1 , no.2) make own communication.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -