MaterializeInc / connection-examples

Materialize connection examples
https://materialize.com/docs
Apache License 2.0
6 stars 3 forks source link

Add GraphQL Subscription Example #25

Open chuck-alt-delete opened 1 year ago

chuck-alt-delete commented 1 year ago

Related to #10 . It seems like GraphQL subscriptions and Materialize fit like hand in glove. We should add an example GraphQL API that allows end users to subscribe to views in Materialize.

benesch commented 1 year ago

Indeed, although the tricky part is writing the backend code that converts an arbitrary GraphQL subscription to the appropriate Materialize SUBSCRIBE command while handling auth, etc.

benesch commented 1 year ago

One thing to note: GraphQL subscriptions aren't a standardized thing. In particular they don't offer any help with update framing—no specification of e.g. "this is how you represent a delete vs an insert vs an update." Every client and server has a different take on how to communicate updates. So we'd have to invent or repurpose one of the existing protocols for this.

chuck-alt-delete commented 1 year ago

Turns out this was exactly what I was looking for:

this opens up a new question for me about how to better surface both connection-examples and demos repos in the docs to to make it much easier for someone to search something like “materialize graphql” and get to that code.