6

I am using graphql-subscriptions to manage session (rooms).

I have simple application like "chat".

I can send message to chat using:

import { PubSub } from 'graphql-subscriptions';
...

pubSub.publish(triggerName, payload)

I can listen to subscription events..

But I don't know how to properly handle when user left to room (for example closing full browser)...

Is there any "disconnect" event?

I am using nestjs server and react with apollo-link-ws

Thank you all.

ciyada8549
  • 61
  • 4
  • +1 I really want to know how to handle this in a Nestful way. The closest I've come is to add the subscriptions property to the GraphqlModule. There you have an onDisconnect event but I have no idea how ti dispatch it to resolvers/services – Nine Magics Apr 26 '20 at 20:01
  • dispatching to resolvers/services is fairly easy using some state management or rxjs – Jensen Jan 11 '21 at 11:07

0 Answers0