connectionState property

ConnectionStateEmitter get connectionState

The connection state emitter for monitoring WebSocket connection status.

Emits connection state changes including Connected, Connecting, Disconnected, and Disconnecting states.

Example:

client.connectionState.listen((state) {
  if (state is Connected) {
    print('Connected to Stream');
  } else if (state is Disconnected) {
    print('Disconnected: ${state.source.closeReason}');
  }
});

Implementation

ConnectionStateEmitter get connectionState;