vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Function HTTPClientResponse.switchProtocol

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

ConnectionStream switchProtocol (
  string new_protocol
) @safe;

void switchProtocol (
  string new_protocol,
  scope @safe void delegate(ConnectionStream) del
) @safe;

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.

Parameters

NameDescription
new_protocol 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.
Authors

Sönke Ludwig, Jan Krüger

Copyright

© 2012-2014 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.