HtmlWebSocketChannel.connect constructor
HtmlWebSocketChannel.connect(
- dynamic url, {
- Iterable<
String> ? protocols, - BinaryType? binaryType,
Creates a new WebSocket connection.
Connects to url
using new WebSocket
and returns a channel that can be
used to communicate over the resulting socket. The url
may be either a
String or a Uri. The protocols
parameter is the same as for
new WebSocket
.
The binaryType
parameter controls what type is used for binary messages
received by this socket. It defaults to BinaryType.list, which causes
binary messages to be delivered as Uint8Lists. If it's
BinaryType.blob, they're delivered as Blobs instead.
Implementation
HtmlWebSocketChannel.connect(url,
{Iterable<String>? protocols, BinaryType? binaryType})
: this(WebSocket(url.toString(), protocols)
..binaryType = (binaryType ?? BinaryType.list).value);