Skip to content

Client side error handling on server shutdown #4116

Answered by darrachequesne
Armag3ddon asked this question in Q&A
Discussion options

You must be logged in to vote

You can listen to the events emitted by the socket object:

socket.on("connect", () => {
  // ...
});

socket.on("connect_error", () => {
  // ...
});

socket.on("disconnect", () => {
  // ...
});

Reference: https://socket.io/docs/v4/client-socket-instance/#events

That being said, net:ERR_CONNECTION_REFUSED errors are managed by the browser itself, we have no control over them and cannot silence them...

Reference: https://socket.io/docs/v4/logging-and-debugging/#error-logs-in-the-browser-console

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Armag3ddon
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