@cloudws/node-api

Node.js server CLoudWS API

Usage no npm install needed!

<script type="module">
  import cloudwsNodeApi from 'https://cdn.skypack.dev/@cloudws/node-api';
</script>

README

CloudWS Node.js lib

Installation

npm install cloudws-node-api

or

yarn add cloudws-node-api

Getting started

import CloudWS from '@cloudws/node-api';

const cloudWS = new CloudWS(process.env.CLOUDWS_TOKEN);

Create channel

cloudWS.createChannel('my_channel')

Get list of channels

cloudWS.getAllChannels();

Send message

cloudWS.sendMessage('my_channel', {data: 'Message to channel'});

Delete message

cloudWS.deleteChannel('my_channel');

Example

import CloudWS from '@cloudws/node-api';

const cloudWS = new CloudWSAPI(process.env.CLOUDWS_TOKEN);
const start = async () => {
     await cloudWS.createChannel('my_channel');
     await cloudWS.sendMessage('my_channel', {data: 'Message to channel'});
     await cloudWS.deleteChannel('my_channel');
};
start();