我有我的websocket ruby服务器:
require 'em-websocket'
require "awesome_print"
ap "WebSocket server started"
EM.run {
EM::WebSocket.run(:host => "0.0.0.0", :port => 8080) do |ws|
ws.onopen { |handshake|
puts "WebSocket connection open"
# Publish message to the client
ws.send "Client connected to #{handshake.path}"
}
ws.onclose { puts "Connection closed" }
ws.onmessage { |msg|
puts "Recieved message: #{msg}"
ws.send "Pong: #{msg}"
}
end
}
如何使用外部websockets消息连接我的rails app websockets? 当我得到正确的信息时,我想展示一些东西。