下面是错误代码: 首次连接 38iNY3W1tJjFJ-zZQtZE 的客户端. debug - setting request GET /socket.io/1/xhr-polling/38iNY3W1tJjFJ-zZQtZE?t=1 362482135950 debug - setting poll timeout debug - discarding transport debug - cleared heartbeat interval for client 38iNY3W1tJjFJ-zZQtZE debug - setting request GET /socket.io/1/jsonp-polling/38iNY3W1tJjFJ-zZQtZE?t =1362482145953&i=0 debug - setting poll timeout debug - discarding transport debug - clearing poll timeout debug - clearing poll timeout debug - jsonppolling writing io.j0; debug - set close timeout for client 38iNY3W1tJjFJ-zZQtZE debug - jsonppolling closed due to exceeded duration debug - setting request GET /socket.io/1/jsonp-polling/38iNY3W1tJjFJ-zZQtZE?t =1362482165976&i=0 debug - setting poll timeout debug - discarding transport
一直是这个样子,我服务端的代码是 var server =http.createServer(app).listen(app.get(‘port’), function() { console.log("Express server listening on port " + app.get(‘port’)); console.log(“服务器已经通过:” + app.get(‘port’) + “端口启动…”); });
var sio= require(‘socket.io’); var io = sio.listen(server); var conns = {}; io.sockets.on('connection’, function(socket) { console.log(“首次连接 " + socket.id + " 的客户端.”);
socket.on('message', function(message){
console.log("客户端的消息: " + message + " -来自" + socket.id);
});
socket.on('disconnect', function(){
console.log("客户端 " + socket.id + " 终止.");
});