WebSocketTransformer constructor Null safety

  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.


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