true-dubach / node-twitch-webhook Goto Github PK
View Code? Open in Web Editor NEWA Node.js library for Twitch Helix Webhooks
License: MIT License
A Node.js library for Twitch Helix Webhooks
License: MIT License
Issue is TypeError: http.createServer is not a function
_Originally posted by @nic11 in #14 (comment)
_const fs = require("fs");
const http =("http");
const server = http.createServer();
server.on('request', (req, res) => {
const rstream = fs.creatReadStream("input.txt");
rstream.on("data", (chunkdata) => {
res.write(chunkdata);
});
rstream.on("end", () =>{
});
rstream.on('error', (err) => {
console.log(err);
res.end("file is not found");
});
});
server.listen(8000,"127.0.0.1");
stops working after 1h - 1h 30m
/ twitch-webhooks WARNING Access to unknown URL/method attempted: GET /
After receiving this message in the console, listening no longer works.
This only happens on the remote server, with local tests everything is fine. Remote Ubuntu Server 20.04 64bit if it matters.
I suspect this is due to ngrok, but not sure about it. What can I do to find out the real reason for this?
node: 14.16.1
npm: 7.11.2
It happens because Twitch replaced JSON property "topic" with HTTP header "Link" in some events and will do it with all the others. Also it's a W3C standard
Implement routing for events, for example
api.your-website.com/twitch-webhooks/follows
api.your-website.com/twitch-webhooks/streams
According to runnit and from using in my app, there's no index.js file, thus can't be required just by using;
require('twitch-webhook')
We need to use;
require('twitch-webhook/src/index.js')
Node Version: 8.9.3 and 9.3.0
NPM Version: 5.6.0
I am getting this error just using the sample code given and replacing with my callback and Host for the listen server.
Is it suppose to point to the listen
config?
listen: {
port: 5000, // default: 8443
host: '127.0.0.1', // default: 0.0.0.0
autoStart: true // default: true
}
or should i be adding a route that points to a function?
or should it point to the callback for the auth? http://localhost:5000/auth/twitch/callback
?
I'm trying to figure out how to properly subscribe to stream changes. The examples show user/follow, but the streams topic requires a user id.
I assume it would be like this:
twitchWebhook.subscribe('streams', {
user_id: 12826 // ID of Twitch Channel
}).then(res => res);
When I do this, I receive a GET request with a challenge. Does this library handle the verification, or that something I still have to do myself?
{"error":"Unauthorized","status":401,"message":"OAuth token is missing"}
What’s changing?
Starting on May 1, 2020, Helix will require the following:Use of OAuth across all endpoints, either via an app access token or user access token.
The client ID provided in the corresponding header must match the client ID used to generate the OAuth token.
Will this library be handling this?
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.