Skip to content

About

A script to proxy the AIS stream that the comar unit provide as websocket.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

comar-ais-proxy

A script to proxy the AIS stream that the comar unit provide as websocket.

How?

Script connects to the Comar AIS web UI to fetch a SID, then sets up a websocket connection. It simulates the three-way-handshake that the browser does to get the stream.

This is then published at :8080

The script runs using node.js: node proxy.js

Then you can publish it using a reversed proxy with a tool such as nginx, apache etc.

Configuration via environment variables

The proxy now reads runtime configuration from environment variables instead of hard-coded globals.

  • AIS_HOST — Comar AIS host IP or hostname (required)
  • AIS_PROTOCOL — HTTP scheme for the AIS UI (http by default)
  • WS_PROTOCOL — WebSocket scheme for the AIS stream (ws by default)
  • LOCAL_PORT — local listen port (8080 by default)
  • RECONNECT_DELAY_MS — reconnect delay in milliseconds (5000 by default)
  • VERBOSE — enable debug logging (true or 1)

Example:

AIS_HOST=192.168.1.168 \
LOCAL_PORT=8080 \
VERBOSE=true \
node proxy.js

Container support

A Dockerfile is included to build a container image for the proxy.

Build locally

docker build -t ghcr.io/<OWNER>/comar-ais-proxy:latest .

Run the container

docker run --rm \
  -e AIS_HOST=192.168.1.168 \
  -e LOCAL_PORT=8080 \
  -e VERBOSE=true \
  ghcr.io/<OWNER>/comar-ais-proxy:latest

GitHub Actions

A workflow is included at .github/workflows/publish-ghcr.yml. It builds and pushes the image to ghcr.io/${{ github.repository_owner }}/comar-ais-proxy on pushes to main.

Why?

Sometimes you want the data, but without exposing the comar unit... this is one way.

Requirements

Node.js and some modules: axios and ws optional: roxy software

About

A script to proxy the AIS stream that the comar unit provide as websocket.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages