Keep socket alive for a configured time
See original GitHub issueCurrently, if the ClientOption lazy is true, the websocket is closed as soon as there are no pending operations.
This adds a lot of overhead in case you have an application that is often sending queries or mutations since the client needs to re-establish the socket for every query/mutation.
It would be great if we could add a new keepalive parameter to ClientOptions that would control how long the socket should remain open after the last subscription has completed.
For instance:
export interface ClientOptions {
...
/**
* How long the client should wait, after the last query/mutation/subscription is completed, before closing the socket.
*
* @default 0 * 1000 (0 seconds)
*/
keepalive?: number;
...
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
2. TCP keepalive overview
The keepalive concept is very simple: when you set up a TCP connection, you associate a set of timers. Some of these timers...
Read more >Does a TCP socket connection have a "keep alive"?
The short answer is yes there is a timeout enforced via TCP Keep-Alive, so no the socket won't remain open forever but will...
Read more >TCP_KeepAlive socket option - IBM
The KEEPALIVEOPTIONS configuration value is used for timing unless a specific value has been provided through the TCP_KeepAlive option. The TCP_KeepAlive option ...
Read more >Configuring TCP/IP keep-alives with EXTRA! to keep idle host ...
This article is about configuring client-side TCP/IP keep-alives with EXTRA! to keep an idle host session connected to the host.
Read more >Custom Configuration of TCP Socket Keep-Alive Timeouts
Since the process doesn't start until a connection has been idle for two hours by default, stale TCP connections can linger for a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I agree! Please open another issue just for the sake of clarity and documentation.
A recipe would be a way, however… I spoke too soon.
@rpastro has actually a great point! I changed my mind, this would be indeed nice to have. Am already cooking up some code for this - bare with me. 😄