Skip to content

Commit

Permalink
Checking if either roomId or token is null when splitting the reconn…
Browse files Browse the repository at this point in the history
…ectionToken, meaning that the reconnectionToken format is invalid
  • Loading branch information
senolem committed Jan 25, 2024
1 parent 5c78c57 commit 1311add
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export class Client {
throw new Error("DEPRECATED: .reconnect() now only accepts 'reconnectionToken' as argument.\nYou can get this token from previously connected `room.reconnectionToken`");
}
const [roomId, token] = reconnectionToken.split(":");
if (!roomId || !token) {
throw new Error("Invalid reconnection token format.\nThe format should be roomId:reconnectionToken");
}
return await this.createMatchMakeRequest<T>('reconnect', roomId, { reconnectionToken: token }, rootSchema);
}

Expand Down

0 comments on commit 1311add

Please sign in to comment.