Return to Blog Home

Always Lurking

Source Live

Always Lurking

How is one supposed to catch all their favourite Twitch streams while also living a life? By Always Lurking!

My problem was that there were so many streamers in the #100Devs community, from the official team, to those from both cohorts who streamed for various reasons - showing how to do projects, coworking and accountability, and just hanging out - but simply subscribing to people wasn't enough.

Why? Because I couldn't keep track of which usernames belonged to the #100Devs community and which were people we had raided in the past, or just people I've personally subscribed to.

Backend

My solutions is this fullstack application called Always Lurking, it consists of a backend that - based on a list of grouped usernames - tracks who is online at one time, initially by checking directly who's online, and after startup creating Eventsub Subscriptions for Twitch to notify it when users went online/offline.

At one point in my subscription-creation process I was receiving errors stating that the subscription already existed which kept me stumped for a day, until I realized I never implemented pagination for my routes, so I wasn't seeing all the current subscriptions, which I used to calculate all the subscriptions that still needed creation.

Another issue I encounted speically with deployment was the inability for Websockets to connect, which I eventually found was due to my Apache configuration missing the necessary rewrite conditions:

RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:PORT/$1" [P,L]

Frontend

The frontend of this would be a React application connected to the backend via a Websocket, which would select which group(s) to be lurking in, and would be passed the updates via the Websocket.


What the frontend did was relatively simple: create embeds for both the player and the chat, organizing the streams into a layout supporting up to 10 concurrent streams.

It additionally had more fine-tuned controls for those that wanted to not see certain usernames, or wanted to watch usernames that I hadn't included in my list.

Lastly it supported the collection of channel points and avoidance of the Purple Screen that would commonly interupt embedded Twitch players, it did this by simply opening that player as a Popup - ruining the customized layout, but allowing uninterupted viewing and collection of channel points!

Future

I know there are ways to customize the position of Popups, which I may attempt if it's desired, the primary issue blocking this would be detecting the correct coordinates to move windows to relative to multi-display setups.