Skip to content

em-websocket wont connect over SSL #142

@stoivo

Description

@stoivo

em-websocket wont connect over SSL

When trying to connect on secure => false connection is working perfectly
but when we try to include tls_options and set secure to true.
server just wont start.
The EventMachine start but EventMachine::WebSocket start boot and get terminated, but EventMachine is still running as a ruby process. What I mean is that I can find it by running ps aux | grep ruby.

This is the STDOUT we get when we start the process.

Server started
Terminating WebSocket Server

We are using Ruby on rails , nginx server & Ubuntu 12.04, but we don't think that have any thing to do with this issue.

We are using Ruby 2.2.2
eventmachine (1.2.0.1)
em-websocket (0.5.1)

for testing purposes we are using letsencrypt for certificates
When we setup ssl for https we added these lines to nginx.conf

ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem;
ssl_certificate_key    /etc/letsencrypt/live/domain/privkey.pem;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';

This is the websocket script

require 'em-websocket'

EventMachine.run {
  EventMachine::WebSocket.start(
    :host => "0.0.0.0",
    :port => 8080,
    :debug => true,
    :secure => true,
    :tls_options => {
      :private_key_file => "/etc/letsencrypt/live/domain/privkey.pem",
      :cert_chain_file => "/etc/letsencrypt/live/domain/cert.pem",
      :cipher_list => "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"
    }
  ) do |ws|
   puts "Sterting Websocket"
   ws.onopen { |connection|
      puts "onOpen"
    }
  end

  puts "Server started"
}

Thanks for looking at this :)
Open issue on eventmachine/eventmachine#733 also, not sure where it belong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions