Fork me on GitHub
#graphql
<
2021-05-05
>
finchharold13:05:01

What does the source-stream method do?

hlship20:05:07

Internally, Lacinia uses core.async to model the asynchronous behavior associated with streams.

hlship20:05:32

However, it doesn't expose that directly, instead it provides a function, a source stream, that your code may repeatedly invoke.

hlship20:05:32

That function puts values into the necessary core.async channels, and ultimately, ensures that the data is pushed down to the client.

finchharold03:05:29

If we have it (source-stream (sum a b)) then we should run the subscription as {subscription (a:1, b:2) {ask anything to return}}

gklijs05:05:52

Yes, something like that. But it's an subscription, so you need something in place that when whatever happens that should result in a new message, you call the source-stream function again.

mafcocinco19:05:30

Does lacinia support Long type in some way? According to https://graphql.org/learn/schema/ it is not part of the standard but individual implementations can support “custom” types. The reason I ask is that a portion of my backend is using Datomic and Datomic ids are Long which is causing problems for lacinia. Currently, I’m converting them to strings but would prefer not to.

hlship20:05:44

You can implement a Long as a custom scalar, which works fine if you are using EDN as your wire format, but may be problematic if using JSON.

thumbsup_all 2