putki.js
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

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);

/putki.js/

    Package Sidebar

    Install

    npm i putki.js

    Weekly Downloads

    0

    Version

    0.4.0

    License

    MIT

    Unpacked Size

    17.6 kB

    Total Files

    12

    Last publish

    Collaborators

    • kumpmati