You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
on: {
connected: (socket) => {
console.log('Connected to websocket');
this.maxRetries = 20;
this.retryLock = false;
activeSocket = socket as WebSocket;
},
ping: (received) => {
if (!received)
// sent
timedOut = window.setTimeout(() => {
if (activeSocket.readyState === WebSocket.OPEN) {
console.log('Closing websocket due to timeout');
activeSocket.close(4408, 'Request Timeout');
}
}, 5000); // wait 5 seconds for the pong and then close the connection
},
pong: (received) => {
if (received) clearTimeout(timedOut);// pong is received, clear connection close timeout
},
How can I inform my user that the websocket is timed out? I would like to use the subscribe on the service and maintain my architecture. I would like to know if I can for example send a message into my subscribers like "closed" or an error while the retries of the websocket are going. So I can display a message to my users.
Any help would be appreciated!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello Everyone!
I have multiple subscriptions in my angular app in a service like this:
And this on my GraphQLWsLink:
How can I inform my user that the websocket is timed out? I would like to use the subscribe on the service and maintain my architecture. I would like to know if I can for example send a message into my subscribers like "closed" or an error while the retries of the websocket are going. So I can display a message to my users.
Any help would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions