Skip to content

Node.js based forum software built for the modern web

adding a check so that websocket method in notif pushing isn't called if the socket server isn't initialised

Julian Lam220b42706f02
diff --git a/src/notifications.js b/src/notifications.js
index 3aafdb346d..67d7b68695 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -197,8 +197,10 @@ var async = require('async'),
plugins.fireHook('action:notification.pushed', {notification: notification, uids: uids});
var websockets = require('./socket.io');
- for(var i=0; i<uids.length; ++i) {
- websockets.in('uid_' + uids[i]).emit('event:new_notification', notification);
+ if (websockets.server) {
+ for(var i=0; i<uids.length; ++i) {
+ websockets.in('uid_' + uids[i]).emit('event:new_notification', notification);
+ }
}
callback();