简体   繁体   中英

NodeJS + Android, Socket.io chat , app crashes on user leaving the chat room

I am using Socket.IO for a chat app I am making. I am a beginner with both node.js and android.

The chat actually works, but when a person leaves a chat room, any chat room, the app crashes and I have to restart it for another user/users to be able to chat again.

The error I get is the following:

C:\\Users\\Tasos\\Desktop\\node.js server\\node_modules\\socket.io\\node_modules\\engine.io\\node_modules\\ws\\node_modules\\ultron\\index.js:80 if (this.ee._events.hasOwnProperty(event)) { ^

TypeError: this.ee._events.hasOwnProperty is not a function at Ultron.remove (C:\\Users\\Tasos\\Desktop\\node.js server\\node_modules\\socket.io\\node_modules\\engine.io\\node_modules\\ws\\node_modules\\ultron\\index.js:80:27) at Ultron.destroy (C:\\Users\\Tasos\\Desktop\\node.js server\\node_modules\\socket.io\\node_modules\\engine.io\\node_modules\\ws\\node_modules\\ultron\\index.js:116:8) at WebSocket.cleanupWebsocketResources (C:\\Users\\Tasos\\Desktop\\node.js server\\node_modules\\socket.io\\node_modules\\engine.io\\node_modules\\ws\\lib\\WebSocket.js:851:36) at emitNone (events.js:91:20) at Socket.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)

Any hints as to what could be at fault here?

Thanks in advance.

确保socket.io版本是最新版本

npm install socket.io --save

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