reconnect method
void
reconnect()
Attempts to reconnect with the same ID. */
Implementation
void reconnect() {
if (disconnected && !destroyed) {
logger.log(
"Attempting reconnection to server with ID $_lastServerId",
);
_disconnected = false;
_initialize(_lastServerId!);
} else if (destroyed) {
throw Exception(
"This peer cannot reconnect to the server. It has already been destroyed.",
);
} else if (!disconnected && !open) {
logger.error(
"In a hurry? We're still trying to make the initial connection!",
);
} else {
throw Exception(
"Peer $id cannot reconnect because it is not disconnected from the server!",
);
}
}