uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.82k stars 568 forks source link

How to configure keep-alive for uWs.App()? #1080

Open lwq057 opened 1 month ago

lwq057 commented 1 month ago

I looked in the documentation, but couldn't seem to find any relevant configuration.

Is keep-alive enabled by default? What are the parameters?

uWs.App()
.get('/',(res, req)=>{
res.end('ok');
})
.listen(8080, (token) => {});
lwq057 commented 1 month ago

I want to set keep-alive to 30s or 60s, how can I do it?

uNetworkingAB commented 1 month ago

It is 10s hardcoded. I think? Maybe we made it an environment variable. If not, could be time to make it so. But very few people have asked for this

lwq057 commented 1 month ago

It is 10s hardcoded. I think? Maybe we made it an environment variable. If not, could be time to make it so. But very few people have asked for this

This will make uWebSockets.js more performant. Configure keep-alive to optimize network performance and reduce TCP connection times in different applications. Usually when using a reverse proxy.

uNetworkingAB commented 1 month ago

I like your sales pitch ✅

ezioda004 commented 1 month ago

This would be a great addition and will add value to backends where applications are behind reverse proxy, which mostly are.