Open Goutte opened 1 month ago
I don't think that they mock the authentication cause its normal OAuth process maybe Testcontainers has a keycloak or something?
Thanks @kanimaru
We don't especially need to mock the OAuth, if we can somehow skip it and use the token the mock server gives us, perhaps it will work ?
I never used a token for the mock server so no clue. But I only used eventsub from it so I don't know.
I was doing some digging into this today, and it seems like a lot of refactoring would need to happen to make it so that the Auth token can be retrieved from the mock data server. I also found the following thread that described how test events are used on different services, which basically describe emulating the response. https://discuss.dev.twitch.com/t/sending-test-events-to-apps/18620
Since the goal is to emulate various stream events I think we can do the following:
1: We do a minor refactor to separate out this match block into a different function. https://github.com/kanimaru/twitcher/blob/3ecd25b4799078fd54b1308e5b148fb9c23ddab7/addons/twitcher/eventsub/twitch_eventsub.gd#L153
2: Create a MockEventSubMessage class that can produce messages as we would expect to see them produced from twitch based on the documentation.
MockEventSubMessage.TwitchEventsub.match_message_type( metadata.message_type, message_payload )
Since we can use the logs to confirm were are able to consume subscription events I think having a class that can generate the various events should provide the same benifit without having to use the twitch mock data api. I am going to start working on expanding this logic as I think it would definitely help with prototyping.
Ok after I was talking with Fortune I think I understood know what you really want :D.
twitch event websocket start-server
to start a eventsub test server.
Configure that you use the debug eventsub within twitcher:
Connect your signal also to
var event_sub = TwitchService.eventsub as TwitchEventsub;
if TwitchSetting.use_test_server:
TwitchService.eventsub_debug.event.connect(_on_received)
event_sub.event.connect(_on_received);`
and send twitch event trigger channel.subscribe -f 132799162 --transport=websocket
Is it that what you are looking for?
We tried using the mock data server to test out subscriptions without paying every time we try.
We started the server with
twitch start
, as per twitch's doc :And this is our (test) config :
We managed to connect to the "official" API and make our requests. We're now trying to connect to the mock, localhost server.
Has anyone done this ? What are we missing ?
Thanks,