Skip to content
This repository was archived by the owner on Jun 10, 2021. It is now read-only.

[FEATURE]: Display real-time viewer stats #16

Open
dgurns opened this issue Sep 18, 2020 · 0 comments
Open

[FEATURE]: Display real-time viewer stats #16

dgurns opened this issue Sep 18, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@dgurns
Copy link
Owner

dgurns commented Sep 18, 2020

Is your feature request related to a problem? Please describe.
When watching a show, you want to see how many other people are watching too.

Describe the solution you'd like
A scalable way to fetch current realtime viewers on a given user page.

Describe alternatives you've considered
A few possible ways to do this, and probably others I haven't thought of yet:

  • Utilize the Redis subscriptions package (graphql-redis-subscriptions) we're using for GraphQL subscriptions, since it keeps track of how many users are currently connected to a given artist page.
  • Use Google Analytics and query their realtime API

Additional context

Update:

  • Can probably use Redis sorted sets. https://redis.io/commands/zadd
    • Client app sends a ping every minute with the current user ID and urlSlug they're on.
    • Add to Redis sorted set saved under the route like urlSlug
    • When adding, delete all keys over a minute old.
    • Get count for sorted set - this will represent all pings within the last minute.
    • Can use that as an estimate for the number of users currently on page.
    • Can probably do this within the same request/response: Send request with userId and urlSlug, get response with number of current viewers
@dgurns dgurns added the enhancement New feature or request label Sep 18, 2020
@dgurns dgurns changed the title [FEATURE]: Research how to display real-time viewer stats [FEATURE]: Display real-time viewer stats Sep 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant