Compare commits

...

2 Commits

2 changed files with 9 additions and 3 deletions

View File

@ -174,7 +174,9 @@ export class SocketUser {
data.objectType,
data.filter
);
callback({ success: true });
if (typeof callback === 'function') {
callback({ success: true });
}
}
async handleSubscribeToObjectUpdateEvent(data, callback) {
@ -182,7 +184,9 @@ export class SocketUser {
data._id,
data.objectType
);
callback(result);
if (typeof callback === 'function') {
callback(result);
}
}
async handleSubscribeToObjectEventEvent(data) {

View File

@ -2,6 +2,7 @@ import log4js from 'log4js';
import _ from 'lodash';
import { loadConfig } from '../config.js';
import { natsServer } from '../database/nats.js';
import { expandObjectIds } from '../database/utils.js';
const config = loadConfig();
// Setup logger
@ -155,11 +156,12 @@ export class UpdateManager {
`${objectType}s.${id}.object`,
this.socketClient.socketId,
(key, value) => {
const expandedValue = expandObjectIds(value);
logger.trace('Object update event:', id);
this.socketClient.socket.emit('objectUpdate', {
_id: id,
objectType: objectType,
object: { ...value }
object: { ...expandedValue }
});
}
);