mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
fix(core): Fix WebSocket close codes
This commit is contained in:
parent
63ffe67dad
commit
a8bfb46183
|
@ -26,7 +26,7 @@ export class Push extends EventEmitter {
|
|||
} else if (!useWebSockets) {
|
||||
(this.backend as SSEPush).add(req.query.sessionId, { req, res });
|
||||
} else {
|
||||
res.status(401).send('Unauthorized');
|
||||
res.status(1008).send('Unauthorized');
|
||||
}
|
||||
this.emit('editorUiConnected', req.query.sessionId);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export const setupPushHandler = (restEndpoint: string, app: Application) => {
|
|||
if (sessionId === undefined) {
|
||||
if (ws) {
|
||||
ws.send('The query parameter "sessionId" is missing!');
|
||||
ws.close(400);
|
||||
ws.close(1008);
|
||||
} else {
|
||||
next(new Error('The query parameter "sessionId" is missing!'));
|
||||
}
|
||||
|
@ -86,9 +86,9 @@ export const setupPushHandler = (restEndpoint: string, app: Application) => {
|
|||
} catch (error) {
|
||||
if (ws) {
|
||||
ws.send(`Unauthorized: ${(error as Error).message}`);
|
||||
ws.close(401);
|
||||
ws.close(1008);
|
||||
} else {
|
||||
res.status(401).send('Unauthorized');
|
||||
res.status(1008).send('Unauthorized');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue