I am the developer of a Twitch overlay. Currently, I only use it myself and run it on localhost.
Until yesterday, it had been working without any problems for months.
my overlay just opens only one websocket connection and closes and tries to reopen it, if it has not received a keepalive message or any other message after more than 10 seconds.
Unfortunately, I received the following error in the POST request for subscriptions: {“Too Many Requests”,“status”:429,“message”:“number of websocket transports limit exceeded”}
Here are the rate limit headers of a failed request:
ratelimit-limit: 800
ratelimit-remaining: 799
What does the error message “429” actually mean? Sounds like it means that too many parallel ws connections are open, but from my point of view I only ever just have one opened. What is the limit? Is there a way to view the current usage of this limit? Is there a way to forcibly close all other connections for this Cliend-ID? How do I know if my Client-ID got blocked? Creating a new Client-ID resolves the Problem, but without knowing the cause it can happen any time again.
Sounds like the other websockets still exist and are hanging open somewhere, since you seem to be using python that suggests hanging python processes that you thought were killed but were not and are still ping/pong-ing away in the background
This has happened in the past with another developer where on “restart”/sefl manated reconnect (not a twitch one) they were leaving the old sockets open/hanging in memory.
So this suggests that these older/previous web sockets are still open and connected
3
> You can create a maximum of 3 WebSockets connections with enabled subscriptions. Reconnecting using a reconnection URL (see Reconnect message) doesn’t add to your WebSocket count.
Get EventSub subscriptions should inform you of what subscriptions are tied to which websocket ID then you just need to find when said websockets are hanging in memory.
I suspect the response wouldn’t be a 429. (not with the stated body message anyway)
Technically thats violating the developer agreement as creating another ClientID to bypass limits
As if it’s happening on clientID (a) it’s gonna happen on the new one
That shouldn’t be the case, as everything has already been restarted multiple times (browser, PC), so nothing else can be open anymore, and I’m still getting the same error with this specific Client-ID. There were several hours between my attempts, and the PC was turned off in the meantime.
Since Twitch couldn’t receive a pong message for several hours, Twitch should have already closed any related web socket connection.
I should also mention that the overlay runs in the web browser via JavaScript.
The new Client-ID is only for testing purpose, as I have run out of ideas what else could lead to this error message.
Cross check get eventsubs to see what socket ID’s have subscriptions in state active and/or it’ll provide the sub created date
Check if your code isn’t spawning multiple websockets/instances
Check you don’t have multiple instances going? (assumed python from the .py extension shown in original screenshot)
Not going to assuming this is a browser source in OBS but it’s not uncommon for some people to have added a source multiple times and you are only debugging one of them and that one is the one loaded last and exhibiting the fault. (similar to what the other guy had last time as they were doing something similar and that guy was also using Javascript but screwed up some logic meaning on a reconnect the previous socket was left alive and ticking due to overloading variables)
It would seem to be the case that it’s still ping-poning.
The strange thing is that it worked for months without any problems. Between one of the last tests where I got the error, the PC was completely disconnected from the power supply for hours, and my overlay is only used on that computer and I still got that error.
If I don’t receive a keepalive within 10 seconds or another message, I explicitly close the connection. However, I will also double-check this.
I sometimes use two instances: one for my streams and one for development. I haven’t touched the Twitch communication part in a while (and it worked for months).
Yes, it runs inside an OBS browser source. But I only use references of my overlay in other scenes to avoid any limitations (since I have already reached the limit of 3 WebSocket connections once in the past). If the scene is switched the overlay adapts itself to the selected scene (I’m listening on a specific OBS JavaScript event for that).
My OAuth 2.0 and Twitch library are written in Python so that it also can be used on the server side in the future. I use Brython (which is an interpreter written in JavaScript that transpiles to JavaScript) to run it in the browser, just some parts are written in vanilla JavaScript. But in the end it is JavaScript, running inside a web browser. This project is also intended as a demo to show what can be achieved with Brython and that some modules can be used on the client and server side with only minor changes. I would like to point out once again that I am currently only using it within a web browser (OBS browser source) and the connection to Twitch is also established in the web browser. The server side part is only to store informations like the last person who raided my channel or to serve a word list for my word guessing game.
I was really concerned that I might have done something wrong, and that I had been blocked and received a misleading error message.