Saturday, 15 April 2017

socket.io-emiiter on Redis has to be reinitialized every time to send data

Have to re-initialize socketEmitter every-time I send data, as shown below

pushNotification.pushData = function (data) {
    var socketEmitter = require('socket.io-emitter')(config.redis);
    socketEmitter = socketEmitter.of('/webSocket');
    socketEmitter.in(data.orgId).emit(data.event, data.msg);

}

If I initialize socketEmitter globally and try to reuse it inside pushData function, the pushData function works only for the first time.



via ASHWIN YADAV

No comments:

Post a Comment