diff --git a/play.pokemonshowdown.com/src/client-connection.ts b/play.pokemonshowdown.com/src/client-connection.ts index 78d59d415..c59da1eac 100644 --- a/play.pokemonshowdown.com/src/client-connection.ts +++ b/play.pokemonshowdown.com/src/client-connection.ts @@ -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(); }; diff --git a/play.pokemonshowdown.com/src/client-main.ts b/play.pokemonshowdown.com/src/client-main.ts index 249506b52..0be0017a4 100644 --- a/play.pokemonshowdown.com/src/client-main.ts +++ b/play.pokemonshowdown.com/src/client-main.ts @@ -295,8 +295,14 @@ class PSPrefs extends PSStreamModel { 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); } } }