mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
increase websocket ping interval to just under a minute instead of the default 15s
This commit is contained in:
@@ -12,7 +12,12 @@ export const useWebSocket = () => {
|
|||||||
const wsProtocol = currentUrl.protocol === "http:" ? "ws" : "wss"
|
const wsProtocol = currentUrl.protocol === "http:" ? "ws" : "wss"
|
||||||
const wsUrl = `${wsProtocol}://${currentUrl.hostname}:${currentUrl.port}/ws`
|
const wsUrl = `${wsProtocol}://${currentUrl.hostname}:${currentUrl.port}/ws`
|
||||||
|
|
||||||
const ws = new WebsocketHeartbeatJs({ url: wsUrl, pingMsg: "ping" })
|
const ws = new WebsocketHeartbeatJs({
|
||||||
|
url: wsUrl,
|
||||||
|
pingMsg: "ping",
|
||||||
|
// ping interval, just under a minute to prevent firewalls from closing idle connections
|
||||||
|
pingTimeout: 55000,
|
||||||
|
})
|
||||||
ws.onopen = () => dispatch(setWebSocketConnected(true))
|
ws.onopen = () => dispatch(setWebSocketConnected(true))
|
||||||
ws.onclose = () => dispatch(setWebSocketConnected(false))
|
ws.onclose = () => dispatch(setWebSocketConnected(false))
|
||||||
ws.onmessage = event => {
|
ws.onmessage = event => {
|
||||||
|
|||||||
Reference in New Issue
Block a user