Skip to content

On error event is only fired after connection is restored #431

Answered by enisdenjo
cgvalayev asked this question in Q&A
Discussion options

You must be logged in to vote

on.error and on.closed are hooked up directly to the browsers WebSocket implementation, see here:

graphql-ws/src/client.ts

Lines 665 to 666 in 48e7bd9

socket.onerror = (err) => emitter.emit('error', err);
socket.onclose = (event) => emitter.emit('closed', event);

If playing with network throttling does not yield the expected results, I reckon it's due to some browser thing. You can confirm this by using the WebSocket directly.

Also, I am having a hard time understanding when the client is trying to retry and how many attempts left.

The retryAttempts client option controls the amount of retries and has the details answering your question. Furthermore, also read abo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cgvalayev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants