WebSocketTransformer constructor

WebSocketTransformer(
  1. {dynamic protocolSelector(
    1. List<String> protocols
    ),
  2. CompressionOptions compression: CompressionOptions.compressionDefault}
)

Create a new WebSocketTransformer.

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.

Implementation

factory WebSocketTransformer(
    {/*String|Future<String>*/ protocolSelector(List<String> protocols),
    CompressionOptions compression: CompressionOptions.compressionDefault}) {
  return new _WebSocketTransformerImpl(protocolSelector, compression);
}