disconnect method
void
disconnect()
Disconnects the Peer's connection to the PeerServer. Does not close any active connections. Warning: The peer can no longer create or accept connections after being disconnected. It also cannot reconnect to the server.
Implementation
void disconnect() {
if (disconnected) {
return;
}
final currentId = id;
logger.log('Disconnect peer with ID:$currentId');
_disconnected = true;
_open = false;
socket.dispose();
_lastServerId = currentId;
_id = null;
emit<String?>(SocketEventType.Disconnected.type, currentId);
}