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

Socketio context information when payload too large #3096

Closed
tvld opened this issue Mar 9, 2023 · 4 comments
Closed

Socketio context information when payload too large #3096

tvld opened this issue Mar 9, 2023 · 4 comments

Comments

@tvld
Copy link

tvld commented Mar 9, 2023

As per socketio/socket.io-client#1518 since socket v4.5.0 there is additional information about why the socket closed; for example when the payload exceeds a certain maxHttpBufferSize threshold. We are uploading 'data:' URI images by socket, so that can happen.

In feathers the socket response does not yet contain the message why we lost socket connection. :
Screenshot from 2023-03-09 11-19-00

@daffl
Copy link
Member

daffl commented Mar 9, 2023

Is this an event that happens on the socket or an error response from the service? Does the Socket.io client itself return more information than that?

@tvld
Copy link
Author

tvld commented Mar 10, 2023

Well, this happens when you send a payload that exceeds the limit. The server than reacts with disconnecting the socket. That is ok, but it's nice if it would pass to the client the reason why it disconnected. Apparently in socketio/socket.io-client#1518 they solved it, but the feathers socket does not pass that property to the client as well... or so it seems )
It's very easy to test:

// app.ts on server
app.configure(
  socketio({
    maxHttpBufferSize: 123, // something stupidly low
    cors: {
      origin: app.get('origins')
    }
  })
)
// in client:
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" // >>>>>> missing param
  console.log(details) // 413 (the HTTP status of the response)
})

And then patch some kind of field with a string longer than 123 characters ;)

@daffl
Copy link
Member

daffl commented Mar 10, 2023

That's why I was asking because the socket you are listening to is just the Socket.io socket and Feathers doesn't really do anything with that. Can you confirm that you are getting a different message on a plain Socket.io setup (my guess it'd be the same)?

@daffl
Copy link
Member

daffl commented Mar 23, 2023

Closing since I don't think Feathers is changing anything in that message and it is what Socket.io itself does.

@daffl daffl closed this as completed Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants