Sha256: c285c22eee8ca9031b8dd4b4bbed633c0228e10483b124d57eb497066aff7c23

Contents?: true

Size: 435 Bytes

Versions: 2

Compression:

Stored size: 435 Bytes

Contents

require File.expand_path('../../lib/websocket-eventmachine-server', __FILE__)

EM.epoll
EM.run do

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

  WebSocket::EventMachine::Server.start(:host => "0.0.0.0", :port => 9001) do |ws|

    ws.onmessage do |msg, type|
      ws.send msg, :type => type
    end

  end

  puts "Server started at port 9001"

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
websocket-eventmachine-server-1.0.1 examples/autobahn_server.rb
websocket-eventmachine-server-1.0.0 examples/autobahn_server.rb