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

This commit is contained in:
Julian Lam
2015-05-15 14:14:20 -04:00
parent fc1b0c8d24
commit 220b42706f

View File

@@ -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();