Sha256: 1c64481b1716400babc7a73c6b883ff48b7653a3295db2494b96805c0de9c385
Contents?: true
Size: 703 Bytes
Versions: 2
Compression:
Stored size: 703 Bytes
Contents
require 'faye/websocket' require 'volt/server/socket_connection_handler' module Volt class WebsocketHandler def initialize(app) @app = app end def call(env) if Faye::WebSocket.websocket?(env) ws = Faye::WebSocket.new(env) socket_connection_handler = SocketConnectionHandler.new(ws) ws.on :message do |event| socket_connection_handler.process_message(event.data) end ws.on :close do |event| socket_connection_handler.closed ws = nil end # Return async Rack response ws.rack_response else # Call down to the app @app.call(env) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
volt-0.9.3 | lib/volt/server/websocket/websocket_handler.rb |
volt-0.9.3.pre6 | lib/volt/server/websocket/websocket_handler.rb |