Simplify WebSocket keepalive logic

This commit is contained in:
Fedor Indutny 2023-06-06 17:36:38 -07:00 committed by GitHub
parent adc8513f41
commit 7abd2280bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 88 additions and 81 deletions

View file

@ -142,6 +142,7 @@ export class SocketManager extends EventListener {
path: '/v1/websocket/',
query: { login: username, password },
resourceOptions: {
name: 'authenticated',
keepalive: { path: '/v1/keepalive' },
handleRequest: (req: IncomingWebSocketRequest): void => {
this.queueOrHandleRequest(req);
@ -269,6 +270,7 @@ export class SocketManager extends EventListener {
name: 'provisioning',
path: '/v1/websocket/provisioning/',
resourceOptions: {
name: 'provisioning',
handleRequest: (req: IncomingWebSocketRequest): void => {
handler.handleRequest(req);
},
@ -483,6 +485,7 @@ export class SocketManager extends EventListener {
name: 'unauthenticated',
path: '/v1/websocket/',
resourceOptions: {
name: 'unauthenticated',
keepalive: { path: '/v1/keepalive' },
},
});