API Reference
Socket API
Real-time task updates using Socket.io.
Socket API
The CloudConvert Socket API offers real time task updates. We use the Socket.io protocol. Socket.io clients are available in JavaScript and other languages. The official Node SDK has a built in handling for the Websocket API.
The Socket.io base host is https://socketio.cloudconvert.com. When joining channels you need to authorize using the Authorization: Bearer API_KEY header (see example below).
Channels and Events
| Channel | Description | Available Events |
|---|---|---|
private-job.{jobId} | Events for a specific job. | job.createdjob.updatedjob.finishedjob.failed |
private-task.{taskId} | Events for a specific task. | task.createdtask.updatedtask.finishedtask.failed |
private-job.{jobId}.tasks | All task events for a specific job. | task.createdtask.updatedtask.finishedtask.failed |
private-user.{userId}.tasks | All task events for your user. You can find out your user id using the users/me endpoint. | task.createdtask.updatedtask.finishedtask.failed |
private-user.{userId}.jobs | All job events for your user. You can find out your user id using the users/me endpoint. | job.createdjob.updatedjob.finishedjob.failed |
Node.js Example
const socket = io.connect('https://socketio.cloudconvert.com');
socket.emit('subscribe', {
channel: 'private-jobs.6559c281-ed85-4728-80db-414561c631e9.tasks',
auth: {
headers: {
Authorization: 'Bearer API_KEY'
}
},
});
socket.on('task.created', function (channel, data) {
console.log(data.task);
});
socket.on('task.finished', function (channel, data) {
console.log(data.task);
});