Module: Async::WebSocket::Response
- Defined in:
- lib/async/websocket/response.rb
Class Method Summary collapse
-
.for(request, headers = nil, **options, &body) ⇒ Object
Send the request to the given connection.
Class Method Details
.for(request, headers = nil, **options, &body) ⇒ Object
Send the request to the given connection.
30 31 32 33 34 35 36 37 38 |
# File 'lib/async/websocket/response.rb', line 30 def self.for(request, headers = nil, **, &body) if request.version =~ /http\/1/i return UpgradeResponse.new(request, headers, **, &body) elsif request.version =~ /h2/i return ConnectResponse.new(request, headers, **, &body) end raise ProtocolError, "Unsupported HTTP version: #{request.version}!" end |