dnsge / twitch-eventsub-framework Goto Github PK
View Code? Open in Web Editor NEWA small framework for creating Twitch EventSub applications
License: MIT License
A small framework for creating Twitch EventSub applications
License: MIT License
Might be good to get raw http request for own need, for example tracing.
Also might be good to pass ctx from request to handlers
What do you think?
The channel.chat.message subscription type sends a notification when any user sends a message to a specific chat room.
Are you familar with ngrok?
I have a problem with that tunnel, my events in dev mode is repeated (retried) by twitch.
I'm used helper for getting tunnel for eventsub client
func GetAppTunnel(ctx context.Context, cfg *config.Config) (net.Listener, error) {
if cfg.AppEnv != "production" {
tun, err := ngrok.Listen(ctx,
ngrok_config.HTTPEndpoint(),
)
if err != nil {
return nil, err
}
return tun, nil
} else {
tun, err := net.Listen("tcp", ":3003")
if err != nil {
return nil, err
}
return tun, nil
}
}
After that using it like:
appTun, err := helpers.GetAppTunnel(appCtx, cfg)
if err != nil {
panic(err)
}
appAddr := lo.
If(cfg.AppEnv != "production", appTun.Addr().String()).
Else(fmt.Sprintf("eventsub.%s", cfg.HostName))
eventSubHandler := handler.NewHandler(services)
go func() {
// manager here is *eventsub_framework.SubHandler
if err := http.Serve(appTun, eventSubHandler.Manager); err != nil {
panic(err)
}
}()
fmt.Println("Listening on %s", appAddr)
twitch-eventsub-framework/handler.go
Line 492 in 6778902
This code never executes, because you have return
in each case statement. So, we not returning anything to twitch, and twitch will retry their request 3 times.
Some eventsub types have version, and some of versions can be deprecrated and unavailable for subscribe, for example follow: https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelfollow
We should care about version in subscribe request.
I can do PR later, but not sure when.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.