WebSocket
Connect to wss://dev-api.spaceoperator.com/ws or ws://localhost:8080/ws
First, you must send authentication message and wait for the response:
{
"Authenticate": {
"token": "YOUR_API_KEY"
}
}token can be either API key or JWT token (without Bearer prefix). Success response with the user ID:
{
"id": 0,
"Ok": {
"user_id": "3b93d859-b9d1-4230-ad4b-e498d7f1b796"
}
}After you post to /flow/start/<flow-id>, you will get a flow_run_id, use it so subscribe to events in Websocket.
Send this text message to subscribe:
{
"SubscribeFlowRunEvents": {
"flow_run_id": "b4e5edc0-6d59-4db2-9eb0-2380906e461c"
}
}Response:
After that, you will receive messages whenever there are new events. sub_id field will tell you which subscription the event belongs to.
When the stream ends, "event": "Done" is sent, you can keep the websocket connection to use again later.
Last updated
Was this helpful?