mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
Preact: Minor autoreconnect fixes (#2444)
This commit is contained in:
parent
482bee7d2a
commit
e7c36480ba
|
|
@ -143,7 +143,8 @@ export class PSConnection {
|
|||
socket.onerror = (ev: Event) => {
|
||||
PS.connected = false;
|
||||
PS.isOffline = true;
|
||||
PS.alert(`Connection error: ${ev as any}`);
|
||||
// no useful info to print from the event
|
||||
PS.alert(`Connection error`);
|
||||
this.retryConnection();
|
||||
PS.update();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -295,8 +295,14 @@ class PSPrefs extends PSStreamModel<string | null> {
|
|||
for (let title of rooms.split(",")) {
|
||||
PS.addRoom({ id: toID(title) as string as RoomID, title, connected: true }, true);
|
||||
};
|
||||
const cmd = `/autojoin ${rooms}`;
|
||||
if (PS.connection?.queue.includes(cmd)) {
|
||||
// don't jam up the queue with autojoin requests
|
||||
// sending autojoin again after a prior autojoin successfully resolves likely returns an error from the server
|
||||
return;
|
||||
}
|
||||
// send even if `rooms` is empty, for server autojoins
|
||||
PS.send(`/autojoin ${rooms}`);
|
||||
PS.send(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user