resume method
Resume the WebSocket connection by re-enabling auto-reconnect and reconnecting if the connection is closed. Useful when the app comes to foreground.
Implementation
Future<void> resume() async {
// Don't resume if websocket was manually closed
if (manuallyClosed) {
return;
}
autoReconnect = true;
// If the connection is closed, reconnect
if (ws == null) {
await _proxyInterface.connectWs(this);
await connected?.future;
}
}