events property

  1. @override
Stream<WebSocketEvent> events

A Stream of WebSocketEvent received from the peer.

Data received by the peer will be delivered as a TextDataReceived or BinaryDataReceived.

If a CloseReceived event is received then the Stream will be closed. A CloseReceived event indicates either that:

  • A close frame was received from the peer. CloseReceived.code and CloseReceived.reason will be set by the peer.
  • A failure occured (e.g. the peer disconnected). CloseReceived.code and CloseReceived.reason will be a failure code defined by (RFC-6455)https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1 (e.g. 1006).

Errors will never appear in this Stream.

Implementation

@override
Stream<WebSocketEvent> get events => _events.stream;