notiflare-client
v0.1.7
Published
A client-side SDK for receiving presence-aware Notiflare notifications.
Downloads
21
Maintainers
Readme
Notiflare JS Client
Provides functionality for receiving and handling Notiflare's presence-aware notifications.
Quick-Start
Install with npm install --save notiflare-client
.
Usage
import { NotiflareClient } from 'notiflare-client';
let config = {
//Your public API Key.
apiKey: 'API_KEY',
//A default handler for notifications.
defaultReceiver: (data) => {
console.log(data);
},
//The URL to an identification endpoint on your backend.
identifyUrl: 'backend.com/identify'
};
//Initialize the client.
let client = new NotiflareClient(config);
//OPTIONAL: Register for non-default notifications.
client.register('myHandler', (data) => {
//Do something with your notification.
});
//Begin listening for notifications.
client.start();