trySendText method

  1. @override
bool trySendText(
  1. String s
)
override

Sends text 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 sendText will be silently discarded if the peer is disconnected but the disconnect has not yet been detected.

Implementation

@override
bool trySendText(String s) {
  if (isClosed) return false;
  sendFrame(WebSocketOpcode.text, utf8.encode(s));
  return true;
}