Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a send a big data to server, I can't get 413 error by listen ‘disconnect’ event #5177

Open
shuntian opened this issue Aug 13, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@shuntian
Copy link

shuntian commented Aug 13, 2024

socket.io: 4.6.1
socket.io-client: 4.6.1

@darrachequesne darrachequesne transferred this issue from socketio/socket.io-client Aug 23, 2024
@darrachequesne
Copy link
Member

Hi! You can use the second argument of the disconnect event:

socket.on("disconnect", (reason, details) => {
  console.log(reason); // "transport error"

  // in that case, details is an error object
  console.log(details.message); "xhr post error"
  console.log(details.description); // 413 (the HTTP status of the response)

  // details.context refers to the XMLHttpRequest object
  console.log(details.context.status); // 413
  console.log(details.context.responseText); // ""
});

@darrachequesne darrachequesne added the documentation Improvements or additions to documentation label Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants