I'm developing a real-time chat app using Apollo GraphQL
, and I want to keep the clients updated about the other client's status.
Mean that I need to do something with the onConnect and OnDisconnect events from the subscriptions object (which defined in app.js) and send a subscription event to the clients whenever a user connected or disconnected.
I could not find an explanation on how to do this, and I would appreciate any help.
you have to use onDisconnect property with context.initPromise like this:
link and link2 for reference.
warning: this is currently working on my local build but not on my heroku production build