Skip to content

Instantly share code, notes, and snippets.

@josefrichter
Created May 14, 2011 12:00
Show Gist options
  • Save josefrichter/972151 to your computer and use it in GitHub Desktop.
Save josefrichter/972151 to your computer and use it in GitHub Desktop.
require 'main'
require 'em-websocket'
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080) do |ws|
ws.onopen { ws.send "Hello Client!"}
ws.onmessage { |msg| ws.send "Pong: #{msg}" }
ws.onclose { puts "WebSocket closed" }
end
run Sinatra::Application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment