closeConnection method

void closeConnection()

Disconnects the _ws connection, without removing the user set on client.

This will not trigger default auto-retry mechanism for reconnection. You need to call openConnection to reconnect to _ws.

Implementation

void closeConnection() {
  logger.info('Closing web-socket connection for ${state.currentUser?.id}');

  // Stop listening to events
  state.cancelEventSubscription();

  _ws.disconnect();
}