info - 未处理的socket.io网址 [英] info - unhandled socket.io url
问题描述
就像在这个页面一样, http://davidwalsh.name/websocket
我是在socket.io v7中获取info - unhandled socket.io url错误。但我不会得到这个错误与v6.17?你有什么想法有这个错误吗?
谢谢
有几天的确切问题,看起来像socket.io在API中有一些变化。
我有一个工作演示的socket.io发送和接收消息 - 上传到 https://github.com/parj/node-websocket-demo as参考
基本上两个更改
-
在服务器端 - 更改
socket.on
tosocket.sockets.on
var socket = io.listen(server);
socket.sockets.on('connection',function(client)
-
在客户端 - URL和端口不需要,因为它是自动检测的。
var socket = io.connect();
注意:您也可以 io 。客户端上的.connect(http://< ip>:< port>)
然而,自动检测不再需要
以下是确切的更改 - https://github.com/ parj / node-websocket-demo / commit / 5ba52db9d1a5b7e8a3af5839adcd12768741dc97
这已经使用Express 2.5.2和Socket.io 0.8.7
I working on a socket.io + node project. Just like in this page, http://davidwalsh.name/websocket I am getting "info - unhandled socket.io url" error in socket.io v7. But I dont get this error with v6.17? Do you have any idea with this error?
Thanks
Had the exact issue couple of days back and looks like socket.io had some changes in the API.
I have a working demo of socket.io sending and receiving a message - uploaded to https://github.com/parj/node-websocket-demo as a reference
Essentially two changes
On Server side - changed
socket.on
tosocket.sockets.on
var socket = io.listen(server); socket.sockets.on('connection', function(client)
On Client side - URL and port not required as it is autodetected.
var socket = io.connect();
NOTE: you can also io.connect("http://<ip>:<port>")
on the client side, however, not required anymore as it is autodetected
Here are the exact changes - https://github.com/parj/node-websocket-demo/commit/5ba52db9d1a5b7e8a3af5839adcd12768741dc97
This has been tested using Express 2.5.2 and Socket.io 0.8.7
这篇关于info - 未处理的socket.io网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!