disconnect method

void disconnect({
  1. String? deviceId,
})

Ends the connections of deviceId (every connection when null) without a close code, as a lost network does.

Implementation

void disconnect({String? deviceId}) {
  for (final c in _open.where(
    (c) => deviceId == null || c.deviceId == deviceId,
  )) {
    c.open = false;
    unawaited(c.socket.close());
  }
}