As the title says I am trying to receive events via WebSocket to use in my app, and I am able to authenticate and subscribe to a number of events successfully (code 202), but I don’t seem to be getting any chat events in? At least the events that I can trigger as the broadcaster and that I am interested in (channel.chat.message,channel.chat.clear, and channel.chat.message_delete) are giving me nothing.
I’ve made sure that other events come in (like channel.update, which came in like 20 times but I think I had stale subscriptions lying around for that), so I don’t think it’s a matter of not having access?
FYI I’m working on custom code inside of Godot so all of this is by hand haha
During testing the dozen subscriptions I was making weren’t expiring or being reused, after a few runs I had almost 200 active subscriptions in a “websocket disconnected” state and had to add logic to delete them all before each run.
I’ve sending POST requests to https://api.twitch.tv/helix/eventsub/subscriptions with the usual auth headers and a request body as indicated in the docs, i.e.
and so on, and I am getting code 202s for every subscription. My code looks basically the same as your example, at least in that I’m hitting the same endpoints with the same information.
For a websocket they’ll self delete after about an hour. (They hang around to help debug why a sub died on it’s own, about an hour for websockets and about 10 days for webhooks)
Otherwise you can just filter Get Subs by state of enabled to ignore stale subs
This is incomplete.
a condition field of user_id is missing…
Whats the body of the response?
I wonder if you have found a weird bug as it should be rejected as your condition is incomplete, as you need to delcare the channel to read the chat of, and which user to read the chat as. I tested it, with the user_id msising from the condition should get a HTTP 400 with
23:24:32Error with eventsub Call channel.chat_settings.update Call: cannot use deprecated subscription type and version
23:24:32Error with eventsub Call channel.chat.clear_user_messages Call: unknown validation error: Key: 'SubscriptionCondition.user_id' Error:Field validation for 'user_id' failed on the 'required' tag
23:24:32Error with eventsub Call channel.chat.notification Call: unknown validation error: Key: 'SubscriptionCondition.user_id' Error:Field validation for 'user_id' failed on the 'required' tag
23:24:32Error with eventsub Call channel.chat.message Call: unknown validation error: Key: 'SubscriptionCondition.user_id' Error:Field validation for 'user_id' failed on the 'required' tag
23:24:32Error with eventsub Call channel.chat.clear Call: unknown validation error: Key: 'SubscriptionCondition.user_id' Error:Field validation for 'user_id' failed on the 'required' tag
23:24:32Error with eventsub Call channel.chat.message_delete Call: unknown validation error: Key: 'SubscriptionCondition.user_id' Error:Field validation for 'user_id' failed on the 'required' tag
Basically you condition is correct for your subs except the chat topics which need a user_id as well
Side Note: depending on the use case for the data, you probably want channel.chat.notification rather than the three channel.sub topics and you can get cheering from channel.chat.message once you have repaired the function
I think this was the critical question actually! Looking at the returned bodies, I saw I was actually subscribing to channel.update each iteration because my POST data dictionary was made before the loop started, so that merged_data.merge(sub) line is quietly failing to change what subscription I’m asking for…
With that changed, I’m seeing the behavior you anticipated, so I’ll just go ahead and fix up my sub dictionaries to have the correct conditions!