Sha256: 022005fce8ce02be68de33d52c4957232e875a27dfeeb38fea6f1c0e07b53d1b
Contents?: true
Size: 656 Bytes
Versions: 12
Compression:
Stored size: 656 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) on_open end def send(message) @connection.send message end def on_message(event) data = event.respond_to?(:data) ? event.data : event super data end end end end
Version data entries
12 entries across 12 versions & 1 rubygems