WebSocket Monitor
Tests WebSocket connections and optionally validates message exchange.
Basic Example
yaml
apiVersion: monitoring.yuptime.io/v1
kind: Monitor
metadata:
name: realtime-ws
namespace: yuptime
spec:
type: websocket
schedule:
intervalSeconds: 30
timeoutSeconds: 10
target:
websocket:
url: "wss://api.example.com/ws"Target Configuration
yaml
target:
websocket:
url: "wss://api.example.com/ws" # Required: ws:// or wss://
headers: # Optional: custom headers
- name: "Authorization"
value: "Bearer token"
send: '{"type": "ping"}' # Optional: message to send
expect: "pong" # Optional: expected responseExamples
Connection Test Only
yaml
apiVersion: monitoring.yuptime.io/v1
kind: Monitor
metadata:
name: chat-websocket
namespace: yuptime
spec:
type: websocket
schedule:
intervalSeconds: 30
timeoutSeconds: 10
target:
websocket:
url: "wss://chat.example.com/socket"With Authentication
yaml
apiVersion: monitoring.yuptime.io/v1
kind: Monitor
metadata:
name: authenticated-ws
namespace: yuptime
spec:
type: websocket
schedule:
intervalSeconds: 60
timeoutSeconds: 15
target:
websocket:
url: "wss://api.example.com/ws"
headers:
- name: "Authorization"
value: "Bearer my-token"Ping/Pong Validation
yaml
apiVersion: monitoring.yuptime.io/v1
kind: Monitor
metadata:
name: ws-health
namespace: yuptime
spec:
type: websocket
schedule:
intervalSeconds: 30
timeoutSeconds: 10
target:
websocket:
url: "wss://api.example.com/ws"
send: '{"type": "ping"}'
expect: "pong"
alertmanagerUrl: "http://alertmanager.monitoring:9093/api/v2/alerts"
alerting:
notifyOn:
down: true
up: falseNotes
- Supports both
ws://andwss://protocols - If
sendis specified, waits for a response - If
expectis specified, validates response contains the string