Merge pull request #7909 from Budibase/reduce-websocket-polling
Reduce websocket polling frequency and cap reconnection attemps
This commit is contained in:
commit
2e5ecce674
|
@ -18,6 +18,14 @@ export const initWebsocket = () => {
|
||||||
const port = location.port || (tls ? 443 : 80)
|
const port = location.port || (tls ? 443 : 80)
|
||||||
const socket = io(`${proto}//${host}:${port}`, {
|
const socket = io(`${proto}//${host}:${port}`, {
|
||||||
path: "/socket/client",
|
path: "/socket/client",
|
||||||
|
// Cap reconnection attempts to 10 (total of 95 seconds before giving up)
|
||||||
|
reconnectionAttempts: 10,
|
||||||
|
// Delay initial reconnection attempt by 5 seconds
|
||||||
|
reconnectionDelay: 5000,
|
||||||
|
// Then decrease to 10 second intervals
|
||||||
|
reconnectionDelayMax: 10000,
|
||||||
|
// Timeout after 5 seconds so we never stack requests
|
||||||
|
timeout: 5000,
|
||||||
})
|
})
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
|
|
Loading…
Reference in New Issue