Merge branch 'ping' into 'main'

Set idleTimeout to 30s for WebSocket connections

See merge request soapbox-pub/ditto!320
This commit is contained in:
Alex Gleason 2024-05-25 19:12:14 +00:00
commit d6727d2d09
2 changed files with 2 additions and 2 deletions

View File

@ -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) {

View File

@ -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;