当前位置: 首页 > 工具软件 > Bone.io > 使用案例 >

SocketIO- GET http://localhost:3000/socket.io/?EIO=3&transport=polling&t=1418187395022-0 404

卫高明
2023-12-01

If you're running Express 4, it appears to me like you're missing the lines of code:

var app = express(); var server = app.listen(3000); 

That will start your web server and set it to port 3000. See the bone simple Express 4 app here: http://expressjs.com/4x/api.html

And, then to start up socket.io, you would add:

var io = require('socket.io').listen(server); 

And, there is no need for this line:

var http = require('http'); 

原文地址:https://www.e-learn.cn/content/wangluowenzhang/160555

 类似资料: