nodejs websocket html5 实时

阅读更多

准备:

 

 

NodeJS nodejs.org

 

Node-WebSocket-Server https://github.com/miksago/node-websocket-server

 

 

服务端:

var spawn = require('child_process').spawn;
var tail = spawn("tail", ['-f', 'development.log']);
  
console.log('starting');


var ws = require("websocket-server");
var server = ws.createServer();
server.addListener("connection", function(connection){
	tail.stdout.on('data',function(data) {
		server.broadcast(data);
	});
});
server.listen(8001, "127.0.0.1");

 

客户端:



	
		tail -f development.log
		
	
	
		

 

 

另一个很易阅读的资源:

 

https://github.com/agreatfool/HTML5-WebSocket-Canvas-Game.git

你可能感兴趣的:(HTML5,Git,HTML,F#)