I’m not an expert at using APIs and I have a system built with node js with a database of streamers, and I want to eventsub to all of them specifically
stream.online stream.offline channel.follow
the way I’m doing it now is, every time the server restarts it goes through all of the streamers, and by using a module called “Twurple”, I send the request to twitch using the module methods and I get the POST request from twitch, I send a 200 OK with the challenge code back, and everything works well
but since the database is a bit large when I request to sub to all of them, it skips some streamers, and doesn’t sub to them, I tried to find a way to check if I already subbed to a streamer or not, and if I didn’t I would try to send a request again after all the requests are done, but I wasn’t quite successful with that.
so I would like to ask:
- Is there a limit to eventsubs requests? if so, what is it? (how many requests in a period of time)
- Is resubbing every time I restart the server a bad thing? if so, how would I go about having all the subs even after restarting the server
- Could I get suggestions on how to go about implementing a check if they’re already subbed to or not?
The reason why some of your requests may not have been successful is because of the rate limit, which limits you to 800 requests per minute, so if you’re making a significant number of requests quickly, then you may hit that limit. The only way to know if that’s your issue with some requests not going through is by you logging the response of your requests, as the error in the response would indicate what is wrong.
It’s not a bad thing, as resubbing has to be done if subscriptions die due to a restart, but ideally the sever used for EventSub should be stable and not need to be too frequently restarted. If your app requires 100% uptime of subscriptions then you would need a 2nd server that you can have subscriptions on too so that when one server is restarted the other still gets the notifications and none are missed.
If server downtime is a common thing for your situation, then perhaps EventSub isn’t the ideal solution for you and polling the API endpoints may be more suitable.
You can use the Get EventSub Subscriptions endpoint to check which subscriptions are active and which ones have been disabled due to your server being offline when notifications were attempted.
Thank you so much for the quick reply, really appreciate it, this was helpful !
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.