It says that cannot read property authorid undefined in socket.broadcast line.
setInterval(function(){
db.query("select * from `notifications`", function(err, rows){
if (rows.length>temp){
for (var i=temp; i<rows.length; i++){
console.log('sending room post', rows[i].authorid);
db.query("select `name` from `users` where `id`=?", [rows[i].authorid ], function(err, name){
name=name[0].name;
socket.broadcast.to(rows[i].authorid).emit('new notification', {
authorname:name,
dpid:rows[i].followid,
read:rows[i].read,
type:rows[i].type,
followstatus:1
});
});
}
temp=rows.length;
}
})
}, 3000);