Closed tvld closed 1 year ago
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?
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 https://github.com/socketio/socket.io-client/issues/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 ;)
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)?
Closing since I don't think Feathers is changing anything in that message and it is what Socket.io itself does.
As per https://github.com/socketio/socket.io-client/issues/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. :