From 16558e24c9c0d2a04458508adb5b946d20b982b0 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 25 May 2024 13:39:19 -0500 Subject: [PATCH] Set idleTimeout to 30s for WebSocket connections --- src/controllers/api/streaming.ts | 2 +- src/controllers/nostr/relay.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/api/streaming.ts b/src/controllers/api/streaming.ts index b67bce8..a69fbb0 100644 --- a/src/controllers/api/streaming.ts +++ b/src/controllers/api/streaming.ts @@ -49,7 +49,7 @@ const streamingController: AppController = (c) => { return c.json({ error: 'Invalid access token' }, 401); } - const { socket, response } = Deno.upgradeWebSocket(c.req.raw, { protocol: token }); + const { socket, response } = Deno.upgradeWebSocket(c.req.raw, { protocol: token, idleTimeout: 30 }); function send(name: string, payload: object) { if (socket.readyState === WebSocket.OPEN) { diff --git a/src/controllers/nostr/relay.ts b/src/controllers/nostr/relay.ts index 259f5e9..4d23999 100644 --- a/src/controllers/nostr/relay.ts +++ b/src/controllers/nostr/relay.ts @@ -154,7 +154,7 @@ const relayController: AppController = (c, next) => { return c.text('Please use a Nostr client to connect.', 400); } - const { socket, response } = Deno.upgradeWebSocket(c.req.raw); + const { socket, response } = Deno.upgradeWebSocket(c.req.raw, { idleTimeout: 30 }); connectStream(socket); return response;