Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 702
Tasos Anesiadis Avatar asked Jan 16 '17 13:01

Tasos Anesiadis


1 Answers

Make sure that the socket.io version is the latest

npm install socket.io --save

like image 136
Ryan Avatar answered Sep 30 '22 06:09

Ryan