Teekeks / pyTwitchAPI

A Python 3.7 compatible implementation of the Twitch API, EventSub, PubSub and Chat
https://pytwitchapi.dev
MIT License
256 stars 38 forks source link

Different "internal" and "external" port #98

Closed DaryeDev closed 2 years ago

DaryeDev commented 2 years ago

I'm using jprq to tunnel my localhost outside of lan, exposing the my port 4047, but it ends up being another number outside. How can I set it to listen on 4047 for eventsub confirmation and set the callback to the other number?

d7415 commented 2 years ago

From the example

hook = EventSub(WEBHOOK_URL, APP_ID, 8080, twitch)

you can replace 8080 with the port you want to listen on internally, and set any external port in the WEBHOOK_URL string.

d-fischer commented 2 years ago

EventSub does not support any port other than 443 (on Twitch's side for the external URL), so that's what the library should already use to register callbacks with Twitch.

d7415 commented 2 years ago

EventSub does not support any port other than 443

Ah, my bad. Maybe I got confused with auth callbacks. But I think the library just registers the URL as given (which would imply 443 for an https URL if not otherwise specified)

DaryeDev commented 2 years ago

EventSub does not support any port other than 443

Ah, my bad. Maybe I got confused with auth callbacks. But I think the library just registers the URL as given (which would imply 443 for an https URL if not otherwise specified)

On Twitch's API Docs it says this:

Your callback must use SSL and listen on port 443

Which is weird, because I can register all events correctly with Ngrok on port 4047...

DaryeDev commented 2 years ago

From the example

hook = EventSub(WEBHOOK_URL, APP_ID, 8080, twitch)

you can replace 8080 with the port you want to listen on internally, and set any external port in the WEBHOOK_URL string.

This approach returns this as an Exception: callback must provide valid https callback with standard port in creation request

d7415 commented 2 years ago

This approach returns this as an Exception: callback must provide valid https callback with standard port in creation request

Yes, as @d-fischer pointed out, Twitch requires HTTPS on the standard port (443) for EventSub.

Which is weird, because I can register all events correctly with Ngrok on port 4047...

Is Ngrok listening on 443 then redirecting to 4047 internally?

DaryeDev commented 2 years ago

Is Ngrok listening on 443 then redirecting to 4047 internally?

I have no idea, but I might stick to ngrok for the moment...