Giter Site home page Giter Site logo

twocket's Introduction

Twocket - (Twitch Socket)

A handy lil wrapper for handing the Twitch Eventsub websockets for Node. This uses ws for the base socket handling, sets up the subscriptions and allows setting of handlers for each type of response.

About Twitch Eventsub Websockets

Current in beta, the websocket interface for the Eventsub events is now available.

Providing an alternative to webhooks (and without having to deal with SSL/ngrok).

Learn more here.

Prerequisites

This class just handles the connectivity, you will need to supply: the Twitch user ID, Twitch app client ID & the authorised user access token for that client.

More info here.

Installation

npm i twocket SoonTm

-- or --

npm install git+https://github.com/ScottMellors/twocket.git

Add this repo as a dependancy in Node.

Get Started

  • Create an instance of a Twocket using the contructor
  • Add listeners for which events you want to listen for (each event has their own returned data type for convenience that match the api here.)
  • start it up with start()

Event Listeners

Setting up an event listener has two options, for the most common use cases I've included wrapped examples such as setOnFollowEvent() & setOnChannelPointRewardRedeem. If you want to listen to any of the other scoped events, you can use setEventSubHandler("EVENTSUB.SCOPE", (eventDataType) => {}).

Contact

Having issues or got a suggestion? Contact me here.

twocket's People

Contributors

scottmellors avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

scomfy

twocket's Issues

Feature Request: Replace scope and event strings to an enum

STORY: As a developer, I want to more easily setup scopes and events, so I will less likely mess up when requesting scopes and binding events.

A/C: An enum structure accessible to devs that rebinds the scope strings e.g. "channel.subscribe" -> Enum.channelSubscribe

Feature Request: Better logging management

STORY: As a developer, I want to enable or disable verbose logging so I have a preference on what is output to the console

A/C: An option on the constructer to optionally show verbose logging events and outputs to the console

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.