Skip to content
/ oocsi-web Public

OOCSI server (supports OOCSI native, OSC, Websockets)

License

Notifications You must be signed in to change notification settings

iddi/oocsi-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OOCSI web

Distribution bundle for OOCSI web server with web socket support and all OOCSI tools for using OOCSI on the web.

Run the server

To use, please extract the release zip into a folder, adjust permissions on bin/oocsi-websocket (chmod a+x bin/oocsi-websocket), then execute the launcher (./bin/oocsi-websocket). To start the server on a different port than the default port 9000, use the addtional -Dhttp.port=<port> command line option.

Web socket connections can connect to /ws, a simple dashboard is available from /dashboard. All information is available from the server landing page /.

OOCSI Websocket communication

First, include the JavaScript source (either as the full library or as the minified library) into the HTML page.

Then connect to an OOCSI server running a websockets adapter:

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

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 from “test channel"
  var position = msg.data.position;
  var color = msg.data.color;
});