cent.js
Javascript library to communicate with Centrifugo HTTP API.
Installation
$ npm i cent.js
Usage
First see available API methods in documentation.
This library contains CentClient
class to send messages to Centrifugo from your node-powered backend:
const { CentClient } = require('cent.js');
const client = new CentClient({
host: 'http://localhost:8000/api',
token: 'XXX'
})
client.publish({
channel: 'public:chat',
data: { input: "test" }
})
client.unsubscribe({ user: 'user_id', channel: 'channel' });
client.disconnect({ user: 'user_id' })
client.getHistory({ channel: 'channel' })
client.getPresence({ channel: 'channel' })
client.getChannels()
client.getInfo()
client.removeHistory({ channel: 'channel' })
Stay in touch
License
MIT © Alexey Filippov