Skip to content

Commit

Permalink
Merge pull request #136 from senolem/master
Browse files Browse the repository at this point in the history
 Checking if either roomId or token is null when splitting the reconnectionToken, meaning that the reconnectionToken format is invalid
  • Loading branch information
endel committed Jan 25, 2024
2 parents 5c78c57 + 1311add commit baa821a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Client.ts
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 baa821a

Please sign in to comment.