Skip to content

MiroDojkic/sse-observable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sse-observable

fetch-based SSE client/EventSource with event emitter interface (WIP ⚠️)

Install

$ npm install --save sse-observable

Usage

const connectSSE = require('sse-observable');

const sse = connectSSE('/sse/endpoint/', {
  headers: { Authorization: 'Bearer ...' }
});

sse.on('open', () => console.log('SSE connection openned! 🎉'));
sse.on('message', data => {}));
sse.on('custom-event', data => {}));
sse.on('error', err => console.log('SSE connection failed: ', err));

License

MIT License

About

Fetch-based SSE client

Resources

License

Stars

Watchers

Forks

Packages

No packages published