npm.io
1.0.11 • Published 5 years ago

@teamtv/eventstream-client

Licence
ISC
Version
1.0.11
Deps
0
Size
8 kB
Vulns
0
Weekly
0

EventStream Client

Simple Client for the teamtv event stream API

Installation

npm install --save @teamtv/eventstream-client

Usage

import { EventStream, SSEEventStreamSource } from '@teamtv/eventstream-client';

const es = new EventStream(
  new SSEEventStreamSource("<teamtv eventstream endpoint>")
);

es.on("shot", (attributes) => {
  if (attributes.result === "GOAL") {
    console.log("Shot", attributes);
  }
});

Keywords