1.0.0 • Published 1 year ago

action-tunnel-client v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

action-tunnel-client

Send or receive action commands to/from other clients when you are not publicly accessable.

Installation

To use the client in your node project, just install it as a dependency:

npm install action-tunnel-client --save

Usage

Connecting

const ActionTunnelClient = require('action-tunnel-client');
const client = await Client.create('ws://localhost:3000/', 'auth-token');

Connect to the action-tunnel-server with its IP/DNS, port and auth token you defined at the server. See https://github.com/byWulf/action-tunnel-client for more information.

Sending actions

await client.send('statusLed', {color: '#ffaa00'});

Receiving actions

client.on('statusLed', (payload) => console.log('Changing led color to ' + payload.color));