使用socket.io创建套接字时出错

时间:2017-01-08 10:43:27

标签: node.js socket.io

我是nodejs的新蜜蜂,在创建套接字连接时,我收到此错误响应,而我从客户端请求套接字连接:

未找到

404

/api/v1/m/projects/{p_id}/sprints/{s_id}/tasks/{t_id}

在bin / www文件中,我在连接事件上执行了一些事件:

Error: Not Found
    at /home/datacloudserver/nodejs/mychat/app.js:30:13
    at Layer.handle [as handle_request] (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:312:13)
    at /home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:330:12)
    at next (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:271:10)
    at /home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:618:15
    at next (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:256:14)
    at Function.handle (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:176:3)
    at router (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:46:12)
    at Layer.handle [as handle_request] (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:312:13)
    at /home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:330:12)
    at next (/home/datacloudserver/nodejs/mychat/node_modules/express/lib/router/index.js:271:10)
    at SendStream.error (/home/datacloudserver/nodejs/mychat/node_modules/serve-static/index.js:121:7)

节点应用正常启动,

但是当我从客户端调用创建socket io对象时,如下所示:

io.on('connection', function(socket){ }); 

此调用会响应我上面粘贴的错误

0 个答案:

没有答案