socket.io 不记录控制台消息
socket.io not log console message
我的本地应用程序已加载并且一切正常 运行,但我无法让终端记录我的连接控制台消息 a user connected
。
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
app.use(express.static(__dirname + '/public'));
io.sockets.on('connection', function(socket) {
console.log('a user connected');
});
server.listen(3000);
我唯一得到的是:
info - socket.io started
debug - served static content /socket.io.js
帮忙?建议?想法?
这是未经测试的代码,来自我之前参与的项目:
var express = require('express')
var app = express();
var io = require('http').Server(app);
var socket = require('socket.io')(io);
socket.on('connect',function(socket){
console.log('got a connection')
});
io.listen(3000)
请尝试这些更改是否适合您..
我的本地应用程序已加载并且一切正常 运行,但我无法让终端记录我的连接控制台消息 a user connected
。
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
app.use(express.static(__dirname + '/public'));
io.sockets.on('connection', function(socket) {
console.log('a user connected');
});
server.listen(3000);
我唯一得到的是:
info - socket.io started
debug - served static content /socket.io.js
帮忙?建议?想法?
这是未经测试的代码,来自我之前参与的项目:
var express = require('express')
var app = express();
var io = require('http').Server(app);
var socket = require('socket.io')(io);
socket.on('connect',function(socket){
console.log('got a connection')
});
io.listen(3000)
请尝试这些更改是否适合您..