class Async::WebSocket::ConnectRequest
This is required for HTTP/1.x to upgrade the connection to the WebSocket
protocol. See tools.ietf.org/html/rfc8441 for more details.
Public Class Methods
new(request, protocols: [], version: 13, &block)
click to toggle source
Calls superclass method
# File lib/async/websocket/connect_request.rb, line 86 def initialize(request, protocols: [], version: 13, &block) body = Hijack.new(self) headers = ::Protocol::HTTP::Headers[request.headers] headers.add(SEC_WEBSOCKET_VERSION, String(version)) if protocols.any? headers.add(SEC_WEBSOCKET_PROTOCOL, protocols.join(',')) end super(request.scheme, request.authority, ::Protocol::HTTP::Methods::CONNECT, request.path, nil, headers, body, PROTOCOL) end
Public Instance Methods
call(connection)
click to toggle source
Calls superclass method
# File lib/async/websocket/connect_request.rb, line 100 def call(connection) response = super Wrapper.new(@body.stream, response) end