-
One of the solutions I have been hoping for in GraphQL is the ability to just "watch" my data. Subscriptions would work, but something didn't feel right about writing a whole new operation on my GraphQL endpoint just to instead watch a certain type of data. The solution I imagine now would be to write a subscription operation like However, I will be eventually deploying my end-solution to the cloud. Having each and every client use If what I said above is correct, then this leads me to the next solution I was hoping for. For context, it's been possible to specify a different subscriptions endpoint, that of which commonly uses some sort of streaming connection, typically websockets. Then, the typical single-response operations in I haven't yet taken the time to inspect the implementation details of this library (There's so much to the GQL ecosystem!) but I was hoping that there would be some way to change connections based on if the If you can't take time to explain a sample implementation, I understand. If at least you could explain briefly why or why not that would be possible, I would greatly appreciate it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In your GraphQL network layer, you can use the E.g. if you are using apollo client you could use the split link for this. |
Beta Was this translation helpful? Give feedback.
In your GraphQL network layer, you can use the
isLiveQueryOperationDefinitionNode
function for identifying whether the operation is a live query and then use the corresponding transport you want to use.E.g. if you are using apollo client you could use the split link for this.