Enhance callback handling in SocketUser class to ensure callback is a function before invocation, preventing potential runtime errors.

This commit is contained in:
Tom Butcher 2026-07-04 15:17:56 +01:00
parent 0748256ce8
commit 7002e5a6c1

View File

@ -174,16 +174,20 @@ export class SocketUser {
data.objectType,
data.filter
);
if (typeof callback === 'function') {
callback({ success: true });
}
}
async handleSubscribeToObjectUpdateEvent(data, callback) {
const result = await this.updateManager.subscribeToObjectUpdate(
data._id,
data.objectType
);
if (typeof callback === 'function') {
callback(result);
}
}
async handleSubscribeToObjectEventEvent(data) {
await this.eventManager.subscribeToObjectEvent(