Skip to content

class HTTP::WebSocketHandler
inherits Reference

A handler which adds websocket functionality to an HTTP::Server.

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]

Included modules

HTTP::Handler

Direct known subclasses

Crystal::Playground::PathWebSocketHandler

Class methods

Methods

#call(context)

View source