Model Changed Event
Request
-
Subscribe
-
Unsubscribe
cn.emit('add-topics', 'model-changed')
cn.emit('remove-topics', 'model-changed')
Response
Response contains the following fields:
Field | Type | Description |
---|---|---|
id |
String |
ID of an entity that was created, deleted or modified. |
changeType |
Integer |
Type of change that triggered this event. |
entityType |
Integer |
Type of the entity that triggered this event. |
user |
Object |
Information about the user who changed the model. |
user.id |
String |
User’s ID. |
user.login |
String |
User’s name. |
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', 'model-changed');
cn.on('model-changed', msg => {
console.log(msg);
});