Ruby ActionScript+;红宝石

Ruby ActionScript+;红宝石,ruby,actionscript-3,Ruby,Actionscript 3,我正在ruby服务器上使用WebSocket require 'em-websocket' def start_server(host, port) EM.run { EM::WebSocket.run(:host => host, :port => port) do |ws| ws.onopen { } ws.onmessage { } ws.onclose { }

我正在ruby服务器上使用WebSocket

require          'em-websocket'

def start_server(host, port)
  EM.run {
    EM::WebSocket.run(:host => host, :port => port) do |ws|
      ws.onopen {

      }
      ws.onmessage {
      }
      ws.onclose {

      }
    end
    puts 'Server is running at' + Time.now().to_s
  }
end

start_server('localhost', 8090)
我需要从ActionScript客户端发送请求。我怎么能做到? 我的代码不起作用

var loader:URLLoader = new URLLoader();
        var request = new URLRequest("http://localhost:8090");
        request.method = URLRequestMethod.POST;
        var variables:URLVariables = new URLVariables();
        variables.exampleSessionId = new Date().getTime();
        variables.exampleUserLabel = "guest";
        request.data = variables;
        try {
            loader.load(request);

        } catch (error:Error) {
            trace("Unable to load requested document.");
        }

也许,您可以建议ruby http服务器的其他实现。谢谢。

我不能代表Ruby方面,但在AS3中,
URLLoader
不是用来连接到Web套接字的,而是用来加载http资源的。对于AS3中的Web套接字,必须使用。AS3中没有内置的实现,但有第三方库,如