We will learn How to use foreach object in Nodejs


Example

socket.on("newmessage", function(obj) {
	obj = JSON.parse(obj);
	obj.forEach(function(items) {
	    console.log(items.userid);
	    var e = "notify-"+items.userid;
	    io.sockets.emit(e, 1);
	});
});

I hope this helped you