Skip to main content

WebSocket API

Real-time communication with EdgeFlow via WebSocket.

Connection

ws://localhost:1880/ws

Authentication

Send authentication message immediately after connecting:

{
  "type": "auth",
  "token": "YOUR_API_KEY"
}

Message Types

Subscribe to Debug Messages

{
  "type": "subscribe",
  "topic": "debug"
}

Subscribe to Flow Events

{
  "type": "subscribe",
  "topic": "flow",
  "flowId": "flow-1"
}

Inject Message

{
  "type": "inject",
  "nodeId": "node-123",
  "payload": { "value": 42 }
}

Event Types

Event Description
debug Debug node output
flow:deployed Flow was deployed
node:status Node status changed
error Error occurred

Example Client

const ws = new WebSocket('ws://localhost:1880/ws');

ws.onopen = () => {
  ws.send(JSON.stringify({ type: 'auth', token: 'YOUR_KEY' }));
  ws.send(JSON.stringify({ type: 'subscribe', topic: 'debug' }));
};

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  console.log(msg.type, msg.payload);
};