Open Source API Gateway

webSocketDemoStream

Version

Acts as a WebSocket backend that pushes demo data, for trying out and testing WebSocket proxies. It accepts the WebSocket upgrade and sends one JSON text message per interval with a running number, a timestamp and a simulated measured value:
{"message":0,"timestamp":"2026-10-12T18:33:35.193Z","value":20.5}

All connected clients receive the same messages, and the stream only advances while at least one client is connected. Messages from clients are ignored. A request that is not a WebSocket upgrade is answered with status 400. The plugin always ends the flow.

See tutorials/websockets/10-WebSocket-Proxy.yaml.

Example Configuration

api:
port: 2000
path:
uri: /stream
flow:
- webSocketDemoStream:
intervalSeconds: 5
api:
   port: 2000
   path:
     uri: /stream
   flow:
     - webSocketDemoStream:
         intervalSeconds: 5

Syntax

webSocketDemoStream:
intervalSeconds: <int>
webSocketDemoStream:
  intervalSeconds: <int>

Attributes

NameRequiredDefaultDescriptionExamples
intervalSecondsfalse1Seconds between two messages. Must be at least 1.5

Can be used in