Open willglynn opened 9 years ago
This is not an issue with the api. Post your suggestions at https://discuss.dev.twitch.tv/c/api
There are plenty of other requests here – currently 21 issues with the Feature label – and at least one other issue (#421) asking for an alternative to polling.
The README said to use the forum for questions or if I need help, and to open an issue on GitHub if I hit a bug. This issue doesn't fit into either category, so I picked GitHub due to the other feature request issues I saw here.
Of the available push notification mechanisms, the only one that's readily adaptable is email, and even then that's only useful if you're wanting to notice when any one of a handful of channels start streaming. This is what I'm wanting to notice, so I hooked that up.
I'm not sure if this would be considered a bug, but it's certainly not ideal:
Timestamp | Event |
---|---|
2015-11-08T21:48:34Z | Twitch generates Subject: <channel> just went live on Twitch email (timestamp according to Date: header) |
2015-11-08T21:48:35.595Z | Email arrives at my mail server |
2015-11-08T21:48:36.119Z | Email is delivered to my "just went live" email handler |
2015-11-08T21:48:36.484Z | GET https://api.twitch.tv/kraken/streams/<channel> returned { "stream":null } |
2015-11-08T21:48:37.025Z | { "stream":null } |
2015-11-08T21:48:37.628Z | { "stream":null } |
2015-11-08T21:48:38.171Z | { "stream":null } |
2015-11-08T21:48:38.709Z | { "stream":null } |
2015-11-08T21:48:39.302Z | { "stream":null } |
2015-11-08T21:48:39.703Z | API reports { "stream":{…} } details which I can act on |
PubSubHubbub would provide notifications without involving a round-trip through SMTP, and without the internal caching problems illustrated by this timeline.
PubSubHubbub is an open protocol that provides an alternative to polling. I would be interested in using this with the Twitch API – specifically, so I can [stop polling](pubsubhubbub why polling sucks)
https://api.twitch.tv/kraken/streams/test_channel
.PubSubHubbub involves three cooperating parts: a publisher (Twitch), subscribers (users like me), and a hub. The publisher must a) pick a hub, b) designate the hub by sending
Link: <…>, rel="hub"
on the supported topics, and c) notify the hub when the topic changes. The hub fans out update notifications to subscribers as appropriate. Users can work the way they do now – and if they wish to subscribe to a resource, they contact the hub designated by that resource'sLink:
header, and the hub verifies their subscription intent. The user is now a subscriber and can therefore stop polling, since the hub will invoke their callback whenever the topic changes.Google runs a public hub at pubsubhubbub.appspot.com. Superfeedr offers a hub product for publishers adding extra features like subscriber export in their free tier, and offering more in their paid tier, including fat pings. There's also plenty of code if you'd prefer to run your own hub.
Some notable high-volume publishers include: