HtmlWebSocketChannel.connect constructor
HtmlWebSocketChannel.connect(
- Object url, {
- Iterable<
String> ? protocols, - BinaryType? binaryType,
Creates a new WebSocket connection.
Connects to url using WebSocket.new 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
WebSocket.new.
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(Object url,
{Iterable<String>? protocols, BinaryType? binaryType})
: this(
WebSocket(
url.toString(),
protocols?.map((e) => e.toJS).toList().toJS ?? JSArray(),
)..binaryType = (binaryType ?? BinaryType.list).value,
);