0.4.0 • Published 9 months ago

putki.js v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

putki.js

Small helper library to ease the use of Putki, a tiny topic-based messaging server. If you need to use this library inside Node.js, you can install the eventsource library and pass it in the options.

Getting started

  1. Install the package using your favourite Node.js package manager:
# npm
npm install putki.js
  1. If you do not already have a client registered, register a client in the Putki dashboard.

  2. Create a new instance of Putki and give it the client secret and an API url, and then you are ready to go!

const putki = new Putki({
	apiUrl: 'http://your-putki-api.com',
	clientSecret: 'your-client-secret'
});

// Subscribe to events from 'some-topic'.
const unsub = await putki.subscribe('some-topic', (evt) => {
	console.log('got event', evt);
});

// unsubscribe from 'some-topic' after 10 seconds
setTimeout(() => unsub(), 10 * 1000);
0.4.0

9 months ago

0.3.0

10 months ago

0.2.0

10 months ago

0.1.0

10 months ago