简体   繁体   中英

Socket.io raises “TypeError: Cannot read property 'push' of undefined”

I am using socket.io for communicating between two servers. The problem is that after I updated the socket.io package to the last version, an issue regarding to this package persists:

  1. https://www.dropbox.com/s/olficgz43zqr39e/Screenshot%202016-10-26%2018.51.11.png?dl=0

  2. https://www.dropbox.com/s/5w92uq10ao94t84/Screenshot%202016-10-26%2018.51.34.png?dl=0

The error of the module:

"Cannot read property 'push' of undefined" -> socket.io -> this.sendBuffer.push(packet) -> LINE: 155.

The issue is regarded to socket.io-client package, and the path of the second screen is:

socket.io-client/lib/socket.js

Did anyone had this issue regarding the socket.io package before?

Finally fixed it. If you're trying to communicate between those packages, make sure you work on the same versions for both of them. If not, some errors could appear, like the error that I wrote above. I updated both packages (socket.io-client - for the front, and socket.io - for the api), and now it works.

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