feat(Web): Attempt to reconnect to server
Close
@@ -20,7 +20,10 @@ export async function connect(
if (typeof token === 'string' && token.length > 0)
connectUrl += `&token=${token}`
- const client = new Client(connectUrl)
+ const client = new Client(connectUrl, {
+ reconnect_interval: 1000 + 3000 * Math.random(), // random interval between 1 and 4 seconds
+ max_reconnects: 300, // attempt to reconnect for ~5-15 minutes
+ })
return new Promise<Client>((resolve) =>
client.on('open', () => resolve(client))
)
