apollographql / apollographql/graphql-subscriptions

How to attach the pubsub.subscribe, unsubscribe function to apollo server?

Open
#179 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
TypeScript
Stars
1.6k
Forks
129
PR merge metrics
No merged PRs in 30d

Description

- [ ] has-reproduction
- [x] question
- [ ] blocking
- [ ] good first issue

I am using apollo server subscription, and I set up the subscription with the regular pubsub in this package.
use the pubsub.asyncIterator for subscriptions, then use the same pubsub.publish(xxx).

pubsub also provide an subscribe and unsubscribe function which keep track of count/clients etc. But these two functions are not called if I just setup like this. I understand these are more for custome behavior and such. But my main goal is to know how many clients are subscribed to my channel, and the parameters when they subscribed, right before I call the pubsub.publish function. What is the best way to do it?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the package API points named in the issue: pubsub.asyncIterator, publish, subscribe, and unsubscribe. Clarify how subscription clients and their parameters can be observed, and document the supported approach before publishing to a channel.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, backend
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.