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,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) {