Fork me on GitHub
#graphql
<
2018-07-18
>
jaimeagudo07:07:02

Hi guys, I am trying to setup a subscription in Lacinia. The original docs & test at https://lacinia.readthedocs.io/en/latest/subscriptions/index.html weren't fully clear and I have found https://lacinia-pedestal.readthedocs.io/en/latest/subscriptions.html# but still see the tests and examples a bit far from a real implementation (probably due my short experience with Lacinia). So, I wonder if there is any real example somewhere on how to drive the data through the streamer after a mutation to a subscription somewhere. The other question is, does it worth to adopt Pedestal just for the matter?

hlship15:07:16

The subscription support inside lacinia is there to provide a general framework for the implementation, which comes in lacinia-pedestal. I don't know enough about the other HTTP stacks to know if they can support web sockets in a way that makes sense for subscriptions.

gklijs16:07:42

I made an implementation using Kafka as source, it's in a private repo, but shared some snippets before as somebody has the same question. It's a simple bank simulation, with several subscriptions, like keeping track of changes to your account. Maybe I should ask to open source it + create a blog post.

gklijs16:07:40

In my case when data came in from Kafka it would check if there where subscriptions active which needed the event.

hiredman16:07:54

it isn't much code at all to use lacinia to drive subscriptions over some other transport, I've been using them to control subscriptions over a http://socket.io socket (which is some elaborate protocol that does detection and fallback between websockets and long polling)

hiredman16:07:35

but I had to read through lacinia-pedestal a bit and ask some questions here to get it working