jrudess / streamdvr

DVR for streaming entertainment
GNU General Public License v3.0
65 stars 16 forks source link

Twitch Websocket support for checking #146

Closed camjac251 closed 3 years ago

camjac251 commented 4 years ago

When I initially requested webhooks as a feature request, I didn't realize that it was cached. From the people I've talked to, webhooks can be delayed by up to a few minutes. I wasn't aware until recently that websockets were supported by Twitch.

Another repo has an implementation for checking streams and it could be much better than the schedule system since it wouldn't have much of a limit on requests or rate throttling.

https://github.com/Hakkin/twitchpipe/blob/master/tools/record.sh#L99 They told me that it was an undocumented event which makes it happen https://github.com/Hakkin/twitchpipe/issues/11#issuecomment-643762847

jrudess commented 3 years ago

Right now, I'm only interested in developing scheduler/TUI code, so StreamDVR only interacts with other sites via 3rd party programs or libraries, but not any code specifically in this repo. But if a PR was submitted with a working solution, or a promising prototype, I'd be willing to help.

The most likely path to gaining this feature would to be to find a JS (or TS) library that creates a twitch websocket connection using your account info, and then provides an API for doing queries or interactions with twitch. With that API, and starting with basic.ts in this repo as an example plugin, a custom event-based websocket plugin can be developed.

However, the fundamental core of StreamDVR is a polling loop. Having a plugin that is event based instead of polling based, will most likely need some fundamental changes to the core code base to work. It's something I've been considering anyway, but I don't have any timeline.