npm install centri-agent
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 {}