This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-28
Channels
- # announcements (5)
- # babashka (7)
- # beginners (101)
- # biff (9)
- # calva (46)
- # cider (6)
- # clj-yaml (2)
- # cljsrn (13)
- # clojure (11)
- # clojure-europe (43)
- # clojure-nl (13)
- # clojure-norway (22)
- # clojurescript (20)
- # conjure (1)
- # cursive (7)
- # data-science (2)
- # datomic (26)
- # emacs (38)
- # graphql (27)
- # gratitude (5)
- # hoplon (8)
- # hugsql (22)
- # humbleui (2)
- # hyperfiddle (6)
- # introduce-yourself (8)
- # joyride (3)
- # lsp (79)
- # malli (6)
- # nbb (67)
- # portal (16)
- # rdf (27)
- # reagent (42)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (36)
- # test-check (17)
- # tools-deps (1)
- # xtdb (15)
Has anyone here made a way to deliver GraphQL subscriptions via webhooks (and not just websockets)? If so, how did you have people register the subscriptions?
last I checked the graphql spec was intentionally vague about how subscriptions get delivered
I don't even know what lacinia has to handle subscriptions by default, but once you get low level enough with lacinia you can use whatever you want for subscriptions (at work we have it setup to write to a core.async), so you could have a subscription that takes a url as an argument and then posts data to the url
Indeed, like hiredman said it's up to you. So you can use a subscription. https://github.com/Ancient-Dragon/dgs-sse-subscriptions-backend-example is a Netflix DGS example that might help.
Right yea, I was thinking more of the registration step, like if there is a good way to re-use the subscription type inside of a mutation or something. It looks like no.
E.g.,
mutation {
registerWebhook(query: subscription { employeesMutated (...) } ) { id }
}
We have websocket subscriptions working now, just thinking about the best API possible for supporting webhooks since customers are asking for that now
Yea, but normally that is done via a websocket individual message, which wouldn't make sense for registering a webhook, you'd probably want a simple 'POST' request
Here is how Shopify does it, for example: https://shopify.dev/api/admin-graphql/2022-04/mutations/webhookSubscriptionCreate
But I know what you mean - you can still do it that way. Though it doesn't provide an obvious way to unregister the webhook.
yeah, all our subscriptions return a subscription id, and we have a separate unsubscribe mutation
the big difference between websockets and webhooks for subscriptions is going to be life times of subscriptions, for websockets the subscription is kind of dead once the connection is dead
http://socket.io so sort of websockets
so it is reasonable to assume a subscription over websockets wouldn't outlast a server
yeah, I just mean you won't be able to count on any internal state in lacinia to keep driving the webhooks