EM-WebSocket
EventMachine based WebSocket server – highly experimental, at this point, at least.
Simple server example
EventMachine.run {
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080) do |ws|
ws.onopen {
puts "WebSocket connection open"
# publish message to the client
ws.send "Hello Client"
}
ws.onclose { puts "Connection closed" }
ws. { |msg|
puts "Recieved message: #{msg}"
ws.send "Pong: #{msg}"
}
end
}