3

When I send a message from client, It is taking around 6 to 10 seconds to reach the server. Lets say the time when i send the message is at 07:30:10 It is receiving at 07:30:16 in the node server. Please help me to findout the reason behind that.

I have a code like below

// global/socket.js
var socket_io = require('socket.io');
var io = socket_io({pingTimeout:630000});
var redis = require('socket.io-redis');
io.adapter(redis({host:'localhost',port:6379}))
module.exports = {io:io}
//socketAPI.js
var socket = require('./global/socket')
global.io = socket.io
var socketApi = {};
socketApi.io = io;

io.on('connection', addSubscriptions);
function addSubscriptions(socket){
   socket.on('subscribe',(data,callback)=>{
       console.log(data);
       console.log(new Date());
  })
}

exports.io = io;
exports.addSubscriptions = addSubscriptions

0 Answers0