Merge branch 'ping' into 'main'
Set idleTimeout to 30s for WebSocket connections See merge request soapbox-pub/ditto!320
This commit is contained in:
commit
d6727d2d09
|
@ -49,7 +49,7 @@ const streamingController: AppController = (c) => {
|
||||||
return c.json({ error: 'Invalid access token' }, 401);
|
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) {
|
function send(name: string, payload: object) {
|
||||||
if (socket.readyState === WebSocket.OPEN) {
|
if (socket.readyState === WebSocket.OPEN) {
|
||||||
|
|
|
@ -154,7 +154,7 @@ const relayController: AppController = (c, next) => {
|
||||||
return c.text('Please use a Nostr client to connect.', 400);
|
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);
|
connectStream(socket);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
Loading…
Reference in New Issue