var sys = require("sys"),
http = require("http"),
io = require("socket.io");
http.createServer(function(request,response){
sys.puts("The request is received");
response.writeHeader(200, {"Content-Type": "text/html"});
response.write("Hello World");
response.write("
And again !");
var delay=3000;
setTimeout(function(){
response.write("
And again with delay of "+delay+"s");
response.end();
}, delay);
}).listen(8080);
sys.puts("Server Running on 8080");
//socket message
io.listen(http);
io.sockets.on('connection', function(socket){
socket.emit('message', {'message': 'helllllo'});
});
$ps -aux | grep node (list all node processes) sasa 1194 0.5 0.4 1303884 79992 ? Ssl Oct24 277:04 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr sasa 1200 0.9 0.8 11722864 138300 ? Ssl Oct24 487:42 node /home/sasa/dex8/dex8-api/starter.js sasa 1207 0.4 0.4 1305676 73672 ? Ssl Oct24 228:43 node /home/sasa/regoch/regoch-www/server sasa 1208 0.3 0.4 1304912 72632 ? Ssl Oct24 198:42 node /home/sasa/dex8/dex8-panel/server/index.js sasa 1224 0.8 0.5 11801892 94384 ? Ssl Oct24 478:20 node /home/sasa/dex8/dex8-www/server/index.js sasa 1236 0.5 0.5 11813132 97932 ? Ssl Oct24 304:24 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js sasa 1255 0.7 0.5 1330860 84176 ? Ssl Oct24 408:22 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js sasa 1257 0.3 0.4 1301028 69036 ? Ssl Oct24 201:58 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js sasa 1289 0.3 0.4 1297724 67288 ? Ssl Oct24 199:11 node /home/sasa/dex8/dex8-kiosk/server/index.js sasa 1363 3.1 2.9 12174644 484784 ? Ssl Oct24 1705:32 node /home/sasa/voovuu/voovuu-pub/server/index.js sasa 1449 0.3 0.3 1166824 64892 ? Ssl Oct24 208:44 node /home/sasa/dex8/dex8-worker/starter.js sasa 1528 1.7 2.7 33121852 445792 ? Ssl Oct24 936:01 node /home/sasa/dex8/dex8-worker/starter.js sasa 1529 0.3 0.3 1100644 64068 ? Ssl Oct24 208:33 node /home/sasa/dex8/dex8-worker/starter.js sasa 1606 0.3 0.3 1100388 64388 ? Ssl Oct24 208:36 node /home/sasa/dex8/dex8-worker/starter.js sasa 1607 0.3 0.3 1100644 64552 ? Ssl Oct24 208:00 node /home/sasa/dex8/dex8-worker/starter.js sasa 1705 0.3 0.3 1101160 65148 ? Ssl Oct24 207:57 node /home/sasa/dex8/dex8-worker/starter.js sasa 1706 0.3 0.3 1101156 65352 ? Ssl Oct24 207:49 node /home/sasa/dex8/dex8-worker/starter.js sasa 1805 0.3 0.4 1167200 66168 ? Ssl Oct24 208:04 node /home/sasa/dex8/dex8-worker/starter.js sasa 1807 0.3 0.3 1100128 64092 ? Ssl Oct24 203:52 node /home/sasa/dex8/dex8-worker/starter.js sasa 1885 0.3 0.3 1099624 64152 ? Ssl Oct24 205:13 node /home/sasa/dex8/dex8-worker/starter.js sasa 1886 1.6 0.9 11858768 162316 ? Ssl Oct24 899:36 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index. sasa 2628167 0.8 0.7 1170996 127360 ? Ssl Nov04 310:23 node /home/sasa/voovuu/voovuu-api/starter.js sasa 3168557 0.6 0.5 11801036 90716 ? Ssl Nov06 220:49 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js sasa 3169051 0.4 0.5 11798408 83644 ? Ssl Nov06 144:26 node /home/sasa/@mikosoft/dodo-examples/server/index.js www-data 4012429 0.0 0.0 2608 588 ? S 15:38 0:00 sh -c ps -aux | grep node www-data 4012431 0.0 0.0 3304 652 ? S 15:38 0:00 grep node