TLS EventMachine Client Connections

It's hard for me to get EventMachine Web Socket Client to connect to the wss:// secure web socket wss:// using TLS.

I have EventMachine web socket server setup and working fine. I can use javascript from the browser and the connections work fine. You just cannot connect EventMachine Web-socket client connections.

I think it might be something with certificates, but not sure how to say it.

Here is my client code:

 require 'eventmachine' require 'em-websocket-client' EM.run do conn = EventMachine::WebSocketClient.connect("ws://0.0.0.0:9110/message") conn.callback do data = {data: 'data'} conn.send_msg data.to_json end conn.errback do |e| puts "Got error: #{e}" end conn.stream do |msg| puts "<#{msg}>" conn.close_connection end conn.disconnect do puts "success" EM::stop_event_loop end end 

I have no mistakes (me)? I can decrypt from the client. And on the server (it works in debug mode) only:

 [[:initialize]] [[:unbind, :connection]] 

I also tried replacing ws: // with wss: // to no avail.

By the way, everything works fine if I proceed from the problem.

Does anyone else have success with this?

+4
source share
1 answer

It turns out that currently EventMachine::WebSocketClient does NOT support wss:// connections. The server does this, but it is a separate project.

I ended up using faye-websocket-ruby , which supports wss://

README.md has usage examples.

+1
source

All Articles