websocketsocket.iographql-subscriptionsws

GraphQL Subscriptions vs socket.io


I'm trying to make real-time application based on websocket and got two options. One is socket.io and the other is GraphQL Subscriptions. But it was hard to find comparison of those.

What can be standard to choose one of them and is there any performance difference?


Solution

  • Socket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server. socket.io

    GraphQL Subscriptions on another hand is a concept that allows clients to listen to real-time messages from the server.

    So basically, GraphQL Subscriptions is a specification that defines the policies & rules that allow GraphQL clients and servers to communicate in real-time. And to implement the feature, you can use real-time tools like Socket.io.

    For more detail, you can take a look at: https://dgraph.io/docs/graphql/subscriptions/