This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-10
Channels
- # announcements (4)
- # babashka (40)
- # beginners (39)
- # calva (16)
- # cljdoc (1)
- # cljs-dev (8)
- # clojure (72)
- # clojure-europe (10)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-spec (9)
- # clojure-uk (12)
- # clojurescript (16)
- # community-development (15)
- # conjure (5)
- # cursive (5)
- # datomic (26)
- # eastwood (1)
- # emacs (7)
- # events (1)
- # figwheel-main (15)
- # fulcro (27)
- # graphql (7)
- # gratitude (4)
- # introduce-yourself (1)
- # malli (4)
- # meander (4)
- # off-topic (2)
- # other-languages (13)
- # polylith (7)
- # reagent (5)
- # reitit (5)
- # shadow-cljs (27)
- # spacemacs (4)
- # sql (3)
- # tools-deps (6)
- # xtdb (13)
So today I was debugging a websocket issue. I have the following situation: Two clients, one creates a thing, the other listens for creation of that thing and then sends a subscription document to listen for updates of that same thing. What I notice is that if I do this sufficiently inside the keep alive window, my client will timeout and reconnect.
Digging in lacinia-pedestal, this stands out: https://github.com/walmartlabs/lacinia-pedestal/blob/7c65886fc57bb4907a36df9c009e5daefd482fa5/src/com/walmartlabs/lacinia/pedestal/subscriptions.clj#L113, The receiving of data from a client and the keep alive timeout are together in an async/alt!
. What I think this means is that a keep alive is sent 25 seconds after the last message was received. So in my case, if I create a subscription at t=0, get an update at t=23 and send my second subscription, I will only get my (first) keep alive at t=58.
Is this a bug in lacinia-pedestal? Is it supposed to send a keep alive every 25 seconds even if the client sends messages in between?
The protocol isn’t very clear: https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md#gql_connection_keep_alive
(also funny how a client only starts to consider keep alives if it receives at least one)
we mitigated it partially by halving the keep alive timeout, so we are not in a hurry 🙂. A coworker suggested to split the loop, one that receives messages, one that does the keep alives
Sure, no rush! Let me know, either here, on GH, or PM of I can help in any way ^^