var io = require(‘socket.io’).listen(server);
io.sockets.on('connection’, function (socket) { //为什么这个关键字是‘connection’,在API中如何查找? console.log(‘User connected’); socket.on('disconnect’, function () { //为什么这个关键字是‘disconnect’,在API中如何查找? console.log(‘User disconnected’); }); });
关于API Class: net.Socket
new net.Socket([options])
socket.connect(port, [host], [connectListener])
socket.connect(path, [connectListener])
我需要去哪里找到上述代码on事件的key words
4 回复