Giter Site home page Giter Site logo

Comments (5)

mitchwadair avatar mitchwadair commented on September 27, 2024

May also want to change how webhooks are configured in the config object. Maybe have all relevant properties in their own object (which puts related params together)

const TES = require('tesjs');
const express = require('express');

// basic express app for example
const app = express();
app.get('/', (req, res) => {
  res.send('OK')
});
app.listen(8080);

// initialize TESjs
const tes = new TES({
    identity: YOUR_CLIENT_ID, // now not an obj as only client id is relevant to ALL cases of ID
    listener: {
        webhook: {
            baseURL: "https://example.com",
            secret: YOUR_SECRET,  // secret is now only useful for webhooks so it moves here
            port: 8080,
            server: app
        },
        ignoreDuplicateMessages: true,
        ignoreOldMessages: true,
    }
});

This would be a breaking change, and require a version number upgrade (v0.5.0 or would it be v1.0.0??), but would also make it so omitting the webhook param would be what implies websocket usage.

from tesjs.

mitchwadair avatar mitchwadair commented on September 27, 2024

Another alternative (that I am now leaning towards) is moving ignoreDuplicateMessages and ignoreOldMessages to options and making listener become webhook:

const TES = require('tesjs');
const express = require('express');

// basic express app for example
const app = express();
app.get('/', (req, res) => {
  res.send('OK')
});
app.listen(8080);

// initialize TESjs
const tes = new TES({
    identity: YOUR_CLIENT_ID, // now not an obj as only client id is relevant to ALL cases of ID
    options: {
        debug: true,
        ignoreDuplicateMessages: true,
        ignoreOldMessages: true,
    },
    webhook: {
        baseURL: "https://example.com",
        secret: YOUR_SECRET,  // secret is now only useful for webhooks so it moves here
        port: 8080,
        server: app
    }
});

This is also a breaking change, and will require a version number upgrade

from tesjs.

mitchwadair avatar mitchwadair commented on September 27, 2024

In the interest of allowing Websocket connections on serverside applications as well, we should also allow client secrets to be specified for app access token use in config.

const config = {
    identity: {
        client_id,
        client_secret, // used only in server-side apps
        user_access_token, // used only in client-side apps
    },
    options: {
        debug,
        ignoreDuplicateMessages,
        ignoreOldMessages,
    },
    webhook: {
        baseURL,
        secret, // required
        port,
        server
    }
}

from tesjs.

mitchwadair avatar mitchwadair commented on September 27, 2024

I've about hit what I can do based on the RFC. Will have to wait until general availability so I can test then PR the changes.

from tesjs.

mitchwadair avatar mitchwadair commented on September 27, 2024

EventSub WebSockets open beta is finally out! My work on this is so stale, I'll be starting mostly fresh.

from tesjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.