Sha256: cf83de24c79aaf9d0c208c57eb350e6c7c10913d0930a7bae9b98f2c6185c4fa
Contents?: true
Size: 747 Bytes
Versions: 4
Compression:
Stored size: 747 Bytes
Contents
module WebsocketRails module ConnectionAdapters class WebSocket < Base def self.accepts?(env) Faye::WebSocket.websocket?( env ) end def initialize(request, dispatcher) super @connection = Faye::WebSocket.new(request.env) @connection.onmessage = method(:on_message) @connection.onerror = method(:on_error) @connection.onclose = method(:on_close) EM.next_tick do on_open end end def send(message) @connection.send message end def on_message(event) data = event.respond_to?(:data) ? event.data : event super data end def close! @connection.close end end end end
Version data entries
4 entries across 4 versions & 2 rubygems