info - 未处理的socket.io网址 [英] info - unhandled socket.io url

查看:225
本文介绍了info - 未处理的socket.io网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个socket.io +节点项目上工作。
就像在这个页面一样, 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参考



基本上两个更改


  1. 在服务器端 - 更改 socket.on to socket.sockets.on

      var socket = io.listen(server); 
    socket.sockets.on('connection',function(client)


  2. 在客户端 - 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

  1. On Server side - changed socket.on to socket.sockets.on

    var socket = io.listen(server);
    socket.sockets.on('connection', function(client)  
    

  2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆