Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 740 Bytes

readme.md

File metadata and controls

34 lines (22 loc) · 740 Bytes

CentriAgent

Install

npm install centri-agent

How To use

Simple, Just import and create Agent then call what method you want:

import { CentriAgent } from 'centri-agent';

const CentrifugoConfig = {
  url: process.env.CENTRI_HOST || '',
  key: process.env.CENTRI_KEY || '',
};

const client = new CentriAgent(CentrifugoConfig.url, CentrifugoConfig.key);

// call method
const { channels } = await client.channels({ pattern: "*" });

console.log(channels);
//=> [{"channelA", "channelB"}]

Hint : methods args without any request parameters need to pass {}

all types are sync with latests Centrifugo api docs (currently v5) you can find in

https://centrifugal.dev/docs/server/server_api#http-api