Upgrades a HttpRequest to a WebSocket connection. If the request is not a valid WebSocket upgrade request an HTTP response with status code 500 will be returned. Otherwise the returned future will complete with the WebSocket when the upgrade process is complete.
If protocolSelector
is provided, protocolSelector
will be called to select what protocol to use, if any were provided by the client. protocolSelector
is should return either a String or a Future completing with a String. The String must exist in the list of protocols.
If compression
is provided, the WebSocket created will be configured to negotiate with the specified CompressionOptions. If none is specified then the WebSocket will be created with the default CompressionOptions.
static Future<WebSocket> upgrade(HttpRequest request, {protocolSelector(List<String> protocols), CompressionOptions compression: CompressionOptions.compressionDefault}) { return _WebSocketTransformerImpl._upgrade( request, protocolSelector, compression); }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-io/WebSocketTransformer/upgrade.html