Skip to content

Instantly share code, notes, and snippets.

@RohitRox
Last active December 16, 2015 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RohitRox/5369168 to your computer and use it in GitHub Desktop.
Save RohitRox/5369168 to your computer and use it in GitHub Desktop.
one-to-one websockets
EventMachine.run do
EM::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => false) do |ws|
ws.onopen do
ws.onmessage { |data|
# ...
# ws.send
}
ws.onclose { |data|
# ...
# ws.send
}
end
end
puts "EM Websocket started at port 8080"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment