destroy method

  1. @override
void destroy()
override

Renders the channel unusable and discards whatever is still queued.

Synchronous, because there is no outcome to wait for: it yields no result and no failure a caller could branch on. A graceful shutdown is await flush(); destroy();, spelled at the call site. Teardown that does have something to await belongs on AtConnection.close(); an awaitable teardown here would let a WebSocket close handshake block the reconnect loop on a peer that never answers.

Implementation

@override
void destroy() {
  _open = false;
  _socket.destroy();
}