Sha256: 26e22efbdceffb6e02a83d6e15795c693e3310778691cdd78df702b4f71a741a

Contents?: true

Size: 451 Bytes

Versions: 5

Compression:

Stored size: 451 Bytes

Contents

module EventMachine
  module WebSocket

    def self.start(options, &blk)
      EM.epoll
      EM.run do

        trap("TERM") { stop }
        trap("INT")  { stop }

        EventMachine::start_server(options[:host], options[:port],
          EventMachine::WebSocket::Connection, options) do |c|
          blk.call(c)
        end
      end
    end

    def self.stop
      puts "Terminating WebSocket Server"
      EventMachine.stop
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
em-websocket-0.0.6 lib/em-websocket/websocket.rb
em-websocket-0.0.5 lib/em-websocket/websocket.rb
em-websocket-0.0.4 lib/em-websocket/websocket.rb
em-websocket-0.0.2 lib/em-websocket/websocket.rb
em-websocket-0.0.1 lib/em-websocket/websocket.rb