close method
Fully close the websocket and all streams
Implementation
Future<void> close() async {
if (isClosed) {
log(
'Tried to close the websocket, '
'but it was already closed.',
name: 'ServerWebsocket.close()',
);
return;
}
try {
await _disconnect();
_connectionState.add(ConnectionState.closed);
await _closeSubjects();
} catch (e, s) {
log(
'close() threw',
name: 'WebsocketClose',
error: e,
stackTrace: s,
);
}
}