Skip to content
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

Configurable websocket keep-alive interval #3539

Closed
walfie opened this issue Dec 15, 2019 · 4 comments · Fixed by #6092
Closed

Configurable websocket keep-alive interval #3539

walfie opened this issue Dec 15, 2019 · 4 comments · Fixed by #6092
Labels
c/server Related to server e/easy can be wrapped up in a couple of days good first issue Good for newcomers k/enhancement New feature or improve an existing feature p/medium non-urgent issues/features that are candidates for being included in one of the upcoming sprints

Comments

@walfie
Copy link

walfie commented Dec 15, 2019

For websocket subscriptions, keep-alive messages are sent every 5 seconds. Is it possible to have this value be configurable? For example if I wanted to set it to 30 seconds instead, or disable it entirely.

It looks like it's hard-coded at the moment (assuming I'm looking at the right place):

@0x777 0x777 added c/server Related to server e/easy can be wrapped up in a couple of days k/enhancement New feature or improve an existing feature p/medium non-urgent issues/features that are candidates for being included in one of the upcoming sprints labels Dec 18, 2019
@0x777 0x777 added the good first issue Good for newcomers label Feb 6, 2020
@arpitjacob
Copy link

Hey guys any way to change this?

@abooij
Copy link
Contributor

abooij commented Sep 9, 2020

To clarify on this, the goal would be to add a configuration flag similar to --stringify-numeric-types that has to be threaded through the codebase to the relevant place (namely server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs). So the steps are:

  1. Add a new KeepAliveDelay newtype wrapper around the Seconds data type (the latter is defined in server/src-lib/Data/Time/Clock/Units.hs).
  2. Expand the ServeOptions data type in server/src-lib/Hasura/Server/Init/Config.hs to additionally store a KeepAliveDelay.
  3. Expand server/src-lib/Hasura/Server/Init.hs to support parsing a --websocket-keepalive flag, that takes a number of seconds, and stores this value in the ServeOptions object.
  4. Somehow pass this value to onConn in server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs. It may be desirable to pass it using MonadReader, using the same style that is used for --stringify-numeric-types which is passed in a QueryContext object. That way, one could simply add a reader constraint to onConn, and ask the compiler where this constraint needs to be satisfied, rather than having to change the number of arguments of many functions.

@KarolKalbarczyk
Copy link

I am going to give this issue a try.

@v0d1ch
Copy link
Contributor

v0d1ch commented Oct 28, 2020

@KarolKalbarczyk I noticed some time passed since your last message and decided to try to tackle this for fun. Please close my PR if you did some work already locally, I didn't mean to steal your thunder just to explore the codebase a bit.

@abooij I think the argument passing through some of the related functions could use some love but I didn't want to go out of scope of the task. If you want this handled just create the issue and I'd be happy to help out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/server Related to server e/easy can be wrapped up in a couple of days good first issue Good for newcomers k/enhancement New feature or improve an existing feature p/medium non-urgent issues/features that are candidates for being included in one of the upcoming sprints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants