trySendBytes method

  1. @override
bool trySendBytes(
  1. Uint8List b
)
override

Sends binary data to the peer, unless connection is already closed (either through close or by the peer). Returns false if connection is known to be closed, otherwise true.

Data sent through sendBytes will be silently discarded if the peer is disconnected but the disconnect has not yet been detected.

Implementation

@override
bool trySendBytes(Uint8List b) {
  if (isClosed) return false;
  sendFrame(WebSocketOpcode.binary, b);
  return true;
}