Archived
1
0

Add check for missing reconnection token

This means something is misconfigured.
This commit is contained in:
Asher 2019-08-23 13:43:45 -05:00
parent c4fd725875
commit 78b6b3afdf
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -266,7 +266,7 @@ export abstract class Server {
await this.preHandleWebSocket(request, socket);
} catch (error) {
socket.destroy();
console.error(error);
console.error(error.message);
}
}
@ -421,8 +421,11 @@ export class MainServer extends Server {
}
protected async handleWebSocket(socket: net.Socket, parsedUrl: url.UrlWithParsedQuery): Promise<void> {
if (!parsedUrl.query.reconnectionToken) {
throw new Error("Reconnection token is missing from query parameters");
}
const protocol = new Protocol(await this.createProxy(socket), {
reconnectionToken: <string>parsedUrl.query.reconnectionToken || "",
reconnectionToken: <string>parsedUrl.query.reconnectionToken,
reconnection: parsedUrl.query.reconnection === "true",
skipWebSocketFrames: parsedUrl.query.skipWebSocketFrames === "true",
});