---
title: "WebSocket endpoint for real-time bidirectional communication."
method: GET
path: "/api/ws"
tags: ["websocket"]
---

# WebSocket endpoint for real-time bidirectional communication.

`GET /api/ws`

This endpoint establishes a WebSocket connection and:
- Streams events to the client whenever flows are created, updated, deleted, started, or stopped
- Sends ping messages every 15 seconds to keep the connection alive
- Handles pong responses from the client

Example usage from JavaScript:
```javascript
const ws = new WebSocket('ws://localhost:3000/api/ws');
ws.onmessage = (event) => {
    const data = JSON.parse(event.data);
    console.log('Received event:', data);
};
ws.onclose = () => console.log('Disconnected');
ws.onerror = (error) => console.error('WebSocket error:', error);
```

## Other responses

- `101` — WebSocket connection upgraded
- `401` — Authentication required (use auth_token query param)

---

[API](https://skmtc.dev/eyevinn/apis/strom-api.md) · [All operations](https://skmtc.dev/eyevinn/apis/strom-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/eyevinn/strom-api/revisions/0df7ca64263f/schema)
