Skip to main content

WebSocket Notifications

GenAIPro provides real-time notifications for Labs task progress via WebSocket.

Connection

Connect to the WebSocket endpoint with your API token as a query parameter:
wss://genaipro.vn/ws?token=<your_api_token>

Events

labs_status_updated

Sent when a Labs TTS task progresses. The process_percentage field indicates completion progress (0–100).
{
  "type": "labs_status_updated",
  "payload": {
    "task_id": "bc69572b-c2d8-43c1-b913-14353e096622",
    "process_percentage": 43
  }
}
FieldTypeDescription
typestringEvent type: labs_status_updated
payload.task_idstringID of the task being processed
payload.process_percentageintegerProcessing progress (0–100). 100 means the task is complete.

Example sequence

{"type":"labs_status_updated","payload":{"process_percentage":21,"task_id":"bc69572b-..."}}
{"type":"labs_status_updated","payload":{"process_percentage":43,"task_id":"bc69572b-..."}}
{"type":"labs_status_updated","payload":{"process_percentage":57,"task_id":"bc69572b-..."}}
{"type":"labs_status_updated","payload":{"process_percentage":71,"task_id":"bc69572b-..."}}
{"type":"labs_status_updated","payload":{"process_percentage":93,"task_id":"bc69572b-..."}}
{"type":"labs_status_updated","payload":{"process_percentage":100,"task_id":"bc69572b-..."}}
When process_percentage reaches 100, the task is complete. You can then fetch the result via GET /v1/labs/task/{task_id}.