jointoucan / finch-graphql

Local GraphQL API in the background process of a web extension.
https://jointoucan.github.io/finch-graphql/
MIT License
56 stars 1 forks source link

Support for subscriptions #159

Open jcblw opened 3 years ago

jcblw commented 3 years ago

I am not quite sure how to support this yet, but it looks like there are a few main things to do.

We will need to update codegen to create the subscription hooks, and I assume we will want to setup the port stuff internally. I think the code in the devtools to connect a port is pretty good for this.

I would like also to have some type of support for this in the devtools. Not sure on what that can look like, but I assume it will probably a list of responses from the subscription.

jcblw commented 3 years ago

Here is a good library we might be able to use or recommend for the creation of async iterators.

https://github.com/apollographql/graphql-subscriptions

jcblw commented 3 years ago

Been digging here is a pretty good look at how the internals of something like this can work.

https://github.com/enisdenjo/graphql-ws/blob/master/src/server.ts#L763