0.0.3 • Published 5 years ago

oocsi v0.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

OOCSI client for Node.js

This OOCSI client allows access to OOCSI from Node.js via the websocket protocol.

How to install

With NPM installed, type in your console:

npm install oocsi

How to use

Then connect to an OOCSI server (which needs to be running a websocket adapter):

var OOCSI = require('oocsi');

OOCSI.connect("ws://_SERVER_ADDRESS_/ws");

// or with specified client handle
OOCSI.connect("ws://_SERVER_ADDRESS_/ws", "client_handle");

You can send data to a channel or individual client (here: "John"):

// JSON data object with two items, position and color
var data = {'position' : 90, 'color': 255};

// send data object to client "John"
OOCSI.send("John", data);

You can subscribe to a channel with a handler to handle messages:

OOCSI.subscribe("testchannel", function(msg) {
	// handle message on “test channel"
	var position = msg.data.position;
	var color = msg.data.color;
});
0.0.3

5 years ago

0.0.2

5 years ago