HTTP::WebSocketHandler
Inherits HTTP::Handler / Reference / Object
A handler which adds websocket functionality to an HTTP::Server.
NOTE: To use WebSocketHandler, you must explicitly import it with require "http"
When a request can be upgraded, the associated HTTP::WebSocket and
HTTP::Server::Context will be yielded to the block. For example:
ws_handler = HTTP::WebSocketHandler.new do |ws, ctx|
ws.on_ping { ws.pong ctx.request.path }
end
server = HTTP::Server.new [ws_handler]
Constructors
Instance methods
call(context) : Nil
Source