pub-ws

The pub-<MsgEnv> for a WebSocket ME. Unlike the other tools it is not tied to an operating system: it is Node.js, bundled and packaged into a single executable.

Repository

https://gitlab.com/industry-of-integrations/pub-ws

Libraries

reconnecting-websocket, ws

USAGE: pub-ws <string>

There is no <0|1> argument. pub-ws always keeps listening, until stopped with ^C.

What it does

  1. Opens a reconnecting WebSocket to ws://localhost:8023.

  2. On open, sends <string> and prints pub-ws: pub → ws — […​].

  3. Prints every message received as pub-ws: pub ← ws — […​].

  4. Never closes the socket. If the server goes away, it reconnects and sends again on the next open.

Whether the tool hears its own string back depends on the server: a reflector that echoes to all clients, including the sender, will return it.

On the wire

Server

ws://localhost:8023, hard-coded

Payload

the string, as one text frame

A WebSocket server must be listening on port 8023 for anything to happen; until one is, pub-ws sits in its reconnect loop.

Source and build

The tool is src/pub-ws.mjs. There is no IPSME_MsgEnv wrapper; it uses reconnecting-websocket over ws directly.

npm ci
npm run build   # rollup -> dist/pub-ws.cjs, then pkg -> bin/pub-ws

The pkg target in package.json is macOS arm64; change it to package for another platform.