Job Added Event

This event fires when a job is created alongside the operation execution.

Event name

job-added

Request

  • Subscribe

  • Unsubscribe

cn.emit('add-topics', 'job-added')
cn.emit('remove-topics', 'job-added')

Response

Response contains the ID of the created job.

Field Type Description

id

String

ID of the job.

Example

Request

const comet = require('socket.io-client');

// Comet settings
const COMET_CONNECT_TIMEOUT = 5000;
const sessionId = "..."
const conf = {
    cometHost: 'https://example.com',
    cometPort: '1234',
};

const url = `${conf.cometHost}` + (conf.cometPort ? `:${conf.cometPort}` : '');
const cn = comet.connect(url, {
    query: { forceNew: true, sessionId },
    timeout: COMET_CONNECT_TIMEOUT,
});

cn.emit('add-topics', 'job-added');

cn.on('job-added', msg => {
      console.log(msg);
});

Response

{
  id: '6368f8552f02f030b7111a0b'
}