[C++ Networking] Http Nginx Keepalives #612
Replies: 3 comments 6 replies
-
@DelinWorks |
Beta Was this translation helpful? Give feedback.
-
@halx99 As has been asked here by delin, is there any way to keep the HTTP connection alive? I'm seeing this in the console output for all HTTP requests:
Does the current implementation using yasio instantly shut down the connection once the HTTP response is received? Is there any way to configure it (per request) so it does keep the connection alive? At the moment it seems to be going through the entire handshake sequence for both TCP and SSL per request, which I assume can be avoided if we could re-use the same connection. |
Beta Was this translation helpful? Give feedback.
-
I havent tried to reprocude, but did you try to setup network service with YOPT_S_TCP_KEEPALIVE? |
Beta Was this translation helpful? Give feedback.
-
I've set up an nginx server so I can host my login and signup system for this game and load the scores
Problem is that I've told nginx to keep the connections open for 120 seconds and it seems that whenever I send a request through my game the connection gets released and not kept alive. I've known this because chrome keeps the connection for exactly 120 secs using NetLimiter and when I inspect the game using NetLimiter the game just releases the connection as soon as the request is done
Why would I keep connections alive? it's because when you're working with multiplayer games you want to minimize the amount of tcp connections to be initialized. so that the server and the game feel fast
As you can see chrome keeps the connection alive as said in nginx config:
But the game keeps dropping the connection as soon as the request is finished:
So how would you go about implementing this in c++ ? (Keeping connections alive for later use)
I initiate connections this way
Beta Was this translation helpful? Give feedback.
All reactions