Overview
The websocket command sends an async request and immediately connects via WebSocket to receive the real-time response. It's the fastest way to test your workflow end-to-end from the command line.
Usage
Bash
# Test with workflowmodelriver websocket --workflow my-workflow --message "Hello from CLI" # With custom payloadmodelriver websocket --workflow my-workflow --payload '{"messages": [{"role": "user", "content": "Test"}]}' # Connect to existing channelmodelriver websocket --channel-id abc-123 --project-id xyz-789 # Verbose outputmodelriver websocket --workflow my-workflow --message "Test" --verboseExample output
✓ Making async request...✓ Request queued: abc-123-def > Channel ID: abc-123-def> Project ID: xyz-789 ✓ Connecting to WebSocket...✓ WebSocket connected✓ Channel joined > Waiting for response... ✅ Response received:{ "status": "success", "data": { ... }, "meta": { ... }}Options
| Option | Description |
|---|---|
--workflow <name> | Workflow to test |
--message <text> | Simple text message |
--payload <json> | Custom JSON payload |
--channel-id <id> | Existing channel ID |
--project-id <id> | Project ID |
--verbose | Show detailed logs |
Troubleshooting
"WebSocket connection failed"
- Verify the API URL is correct
- Check that the
ws_tokenhasn't expired (24-hour limit for CLI tokens) - Check network connectivity
- If using production, ensure you're using
wss://(secure WebSocket)
Next steps
- Listen: Monitor webhook events via WebSocket
- Trigger: Send requests without WebSocket monitoring
- Client SDK: Frontend WebSocket integration