mitchwadair / tesjs

Streamline your Twitch EventSub JavaScript integration with TESjs
https://www.tesjs.net/
MIT License
29 stars 6 forks source link

Allow TES config to allow url for websocket connect to Twitch Mock CLI #77

Closed fairbairn closed 1 year ago

fairbairn commented 1 year ago

I see that tests have been worked on to monkey patch the connection to use a locally running websocket server.

Can we have a simple addition to the new TES(config) process where config would allow us to provide a URL of a locally running Twitch CLI mock server for eventsubs?

By default, it comes up as ..

ws://127.0.0.1:8080/ws

but in many cases, we have to change the ports. Allowing us to pass that in directly would be ideal.

Thoughts?

mitchwadair commented 1 year ago

Definitely a reasonable request. I'll try to get that in soon, should be a quick one. (or you can always make a PR if you want!)

mitchwadair commented 1 year ago

released in v1.0.2 🚀

mitchwadair commented 1 year ago

Something to note on local testing

You still must call tes.subscribe to initiate a connection with the Twitch CLI local WebSocket server. This will cause TES to attempt to make a request to the Twitch API's eventsub subscribe endpoint. Even though this will fail (because the WebSocket connection ID will not be valid), you will still be able to trigger mock events from CLI that TES will pick up.