-
Notifications
You must be signed in to change notification settings - Fork 591
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
us_listen_socket_close is suppose to close all connections or just http #663
Comments
|
Hello @e3dio
and to shutdown i used this simple get:
after calling shutdown on that token i can no longer reach http which is expected but i can still connect to ws socket . is that expected?
|
@jcherrabi I don't see you closing any websockets in your shutdown code, that would probably fix your issue #575 |
Just to expand on what is being said here for HTTP connections: in the case of HTTP connections that are using Keep Alive (sending a This means that uWS cannot gracefully close a long-lived HTTP connection later like it can with a WS connection. The following code will cause the process to run indefinitely, even after sending SIGINT (Ctrl + C) to the server, as the client keeps the connection open even after us_listen_socket_close as closed. There is no way for the server to keep track of the open HTTP connection to gracefully dispose of them. // server.js
// run as `node server`
const {App, us_listen_socket_close} = require('uWebSockets.js');
let _listenSocket = null;
App().any("/*", (res) => {
res.end("hello"); // don't send `end(_, true)` because we _want_ to allow keep alive connections.
}).listen(5555, (listenSocket) => {
_listenSocket = listenSocket;
console.log("listening...");
});
process.on("SIGINT", () => {
us_listen_socket_close(_listenSocket)
_listenSocket = null;
console.log("Listen socket closed, waiting for process to exit...");
});
I couldn't find a way to work around this that doesn't involve For WS connections it's easy, as we already have to keep track of those, so on shutdown we can iterate over them and close them all. For HTTP I don't see how it is possible. |
If you add |
|
Http timeout is 10 seconds, is not determined by what client sends in header, might be short enough for you https://github.com/uNetworking/uWebSockets/blob/master/src/HttpContext.h#L44 |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hello everyone,
when i call
us_listen_socket_close
it seems to close the http/https socket but not the websockets sonnections, is this the correct behavior ? and i should handle closing down the websockets separately?thanks,
Jay
The text was updated successfully, but these errors were encountered: