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.
15 16 17 18 19 20 21 22 23 |
# File 'lib/async/websocket/response.rb', line 15 def self.for(request, headers = nil, **, &body) if request.version =~ /http\/1/i return UpgradeResponse.new(request, headers, **, &body) elsif request.version =~ /http\/2/i return ConnectResponse.new(request, headers, **, &body) end raise UnsupportedVersionError, "Unsupported HTTP version: #{request.version}!" end |