-
Notifications
You must be signed in to change notification settings - Fork 17
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
Unable to close fastify server with open connections #88
Comments
@alemagio @matteovivona any thoughts on this? |
Hi @giovanni-bertoncelli, the plugin adds an hook to make sure that the socket is closed when the fastify instance is closed. |
Yes, I saw that.. but |
I can make a PR if you want |
Sure, it would be great 😄 |
I'm reporting a bug discussed here: fastify/help#988.
It seems that
fastify-socket.io
is missing some logic like the one illustrated here with fastify-websocket: https://github.com/fastify/fastify-websocket/blob/431cba461f0bdd133d607deee6cfc56b69ea379a/index.js#L155-L172.Description
When a fastify instance gets closed the fastify-socket.io plugin never closes its underlying websocket connections so the server hangs indefinitely. There should be some logic that forces the plugin to close at least the local sockets in order to close correctly the underlying HTTP server.
Reproduction
In order to reproduce the issue you can use this example https://codesandbox.io/p/devbox/socketio-close-stuck-jlcglp, and following these steps:
npm start
node client.js
Proposal
I'd like to have some
forceClose
parameter in order to close the local websockets by using socket.io API:Or, since fastify has already a parameter for this check whenever
forcecloseconnections
is true and force the disconnection.Another option can be some
preClose
parameter with a design similar to the mentioned fastify-websocket.The text was updated successfully, but these errors were encountered: