简体   繁体   中英

info - unhandled socket.io url

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM