Sha256: 90323dc6f18ab4c14b5001b7b18c2307a46911222139c5b94746bb8e19d05077
Contents?: true
Size: 771 Bytes
Versions: 1
Compression:
Stored size: 771 Bytes
Contents
require 'em-websocket' module MadChatter module Servers class EventMachineWebSocket def initialize(main_server, port) @main_server = main_server @config = { :host => '0.0.0.0', :port => port } end def start EventMachine::WebSocket.start(@config) do |ws| ws.onopen do connection_id = @main_server.register_connection do |msg| ws.send(msg) end ws.onclose do @main_server.connection_closed(connection_id) end ws.onmessage do |msg| @main_server.message_received(msg) end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mad_chatter-0.1.0 | lib/mad_chatter/servers/em_websocket.rb |