HTTPClientResponse.switchProtocol

Switches the connection to a new protocol and returns the resulting ConnectionStream.

The caller caller gets ownership of the ConnectionStream and is responsible for closing it.

Notice: When using the overload that returns a ConnectionStream, the caller must make sure that the stream is not used after the HTTPClientRequest has been destroyed.

  1. ConnectionStream switchProtocol(string new_protocol)
  2. void switchProtocol(string new_protocol, void delegate(ConnectionStream str) @(safe) del)
    class HTTPClientResponse
    @safe
    void
    switchProtocol
    (,
    scope void delegate
    (
    ConnectionStream str
    )
    @safe
    del
    )

Parameters

new_protocol string

The protocol to which the connection is expected to upgrade. Should match the Upgrade header of the request. If an empty string is passed, the "Upgrade" header will be ignored and should be checked by other means.

Meta