HTTPServerResponseData.switchProtocol

Special method sending a SWITCHING_PROTOCOLS response to the client.

Notice: For the overload that returns a ConnectionStream, it must be ensured that the returned instance doesn't outlive the request handler callback.

Notice: The overload which accepts a connection_handler alias is used for HTTP/1 to HTTP/2 switching in cleartext HTTP

  1. ConnectionStream switchProtocol(string protocol)
  2. void switchProtocol(string protocol, void delegate(scope ConnectionStream) @(safe) del)
    struct HTTPServerResponseData
    protected @safe @safe
    void
    switchProtocol
    (
    string protocol
    ,
    scope void delegate
    (
    scope ConnectionStream
    )
    @safe
    del
    )

Parameters

protocol string

The protocol set in the "Upgrade" header of the response. Use an empty string to skip setting this field.

Meta