zorchenhimer / MovieNight

Single instance video streaming server with integrated chat.
https://discord.gg/F2VSgjJ
MIT License
683 stars 87 forks source link

How many people are watching? #109

Closed Aphris-Karu closed 4 years ago

Aphris-Karu commented 4 years ago

Would be nice to have a counter or a stats page that displays how many people are currently watching the stream.

zorchenhimer commented 4 years ago

Type /stats in chat.

I do want to get a live count under or on top of the video eventually. I'll probably get atound to that when I rework some of the video specific stuff.

Aphris-Karu commented 4 years ago

Taking a look at /stats shows how many are in chat but how many were watching?

Looking at my HAProxy that handles the reverse proxy into my cloud it looks like there were 24 sessions and only 7 people in chat.

We did a Co-Vid movie night for the family last night and the MovieNight server (Running in a Docker Swarm) worked perfectly! Thank you for the great Server.

zorchenhimer commented 4 years ago

Getting accurate viewer counts is going to be very tough. Twitch has trouble with this, and they're backed by Amazon.

Currently, the number is simply the number of connected chat clients. Each client will make two connections to the server. One for the video feed and one one websocket connection for the chat (and probably some additional sessions for standard HTTP downloads for emotes and the HTML). This is probably why you are seeing more connections in HAProxy than are reported with the /stats command.

Aphris-Karu commented 4 years ago

Ok I have spent a few days thinking about this. The more I thought about it the more I realized just how hard it would be to implement.

That is an interesting problem and one that I do not see a good solution to.

zorchenhimer commented 4 years ago

Yea, it's not an easy fix. The number of users in chat is usually "good enough" for my purposes.