Skip to content

iddi/oocsi-web

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 /.

Run with Docker or Podman

You can easily run an OOCSI server using Docker or Podman without needing to extract files or configure anything manually. The container images are available at ghcr.io/iddi/oocsi-web.

Quick Start with Docker

docker run -d 
  --name oocsi-server 
  -p 9000:9000 
  -p 4444:4444 
  ghcr.io/iddi/oocsi-web:latest

Then access:

Quick Start with Podman

podman run -d 
  --name oocsi-server 
  -p 9000:9000 
  -p 4444:4444 
  ghcr.io/iddi/oocsi-web:latest

Then access:

Port Mappings

  • Port 9000: HTTP server (web dashboard and WebSocket endpoint)
  • Port 4444: OOCSI native protocol port

Stopping the Container

# Docker
docker stop oocsi-server
docker rm oocsi-server

# Podman
podman stop oocsi-server
podman rm oocsi-server

Custom Port Configuration

If you need to run the server on different ports, you can adjust the port mappings:

# Docker example: run on ports 8080 and 5555 instead
docker run -d \
  --name oocsi-server \
  -p 8080:9000 \
  -p 5555:4444 \
  ghcr.io/iddi/oocsi-web:latest

The format is -p <host-port>:<container-port>, so the container always uses 9000 and 4444 internally.

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("wss://_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", (msg) => {
  // handle message from "test channel"
  var position = msg.data.position;
  var color = msg.data.color;
});