How to use subscription in GraphQL #4410
|
Hello everyone, I'm currently learning GraphQL and came across subscriptions, but I'm not sure how they work or when exactly to use them. When should I use GraphQL subscriptions over queries or mutations? How do I implement them, especially in a Laravel (Lighthouse) setup? Any good resources or documentation to help me get started? Would love to hear your thoughts or any practical examples you’ve used. Thanks in advance! |
Answered by
codenarts84
May 22, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Great question — GraphQL subscriptions are used when you need real-time updates from your server to the client.
When to Use Subscriptions
-Live updates needed (Chatting app, Notifications, Stock prices, etc)
if you're just fetching or sending data once, use queries or mutations instead
How to Use Subscriptions
Doc is here:
https://www.graphql-yoga.com/docs/features/subscriptions