ATAPI Twin
Pages

Build

WebSocket and Kafka

Sockets and topics on the local hub, plus HTTP stand-ins.

WebSocket routes listen on ws://localhost:3001/sim/{slug}{path}. The route body is {"open":["connected"],"reply":"echo {{body}}"}. When a socket is not available, POST /sim/{slug}/__ws exchanges one frame over HTTP.

A Kafka route uses the collection field as the topic name. POST produces records. GET reads them from an offset. Over HTTP, POST /sim/{slug}/__kafka/topics/{topic} with {"records":[{"value":{...}}]} appends, and the same path with GET reads.

The hub binds 127.0.0.1. A hosted worker does not run that process, so socket and topic calls are for a machine where the hub is up. The HTTP stand-ins above still hit the twin.