simon-kyger / zealotry

A team based multiplayer pvp game.
MIT License
0 stars 1 forks source link

io is undefined in disconnect method #2

Closed simon-kyger closed 6 years ago

simon-kyger commented 6 years ago

after your refactoring of a ton of code, i gave the server/client a quick testrun.

login to the game to launch the overworld.js client, and refresh window on this screen, server crashes with this stack trace:

C:\Users\Simon Kyger\Desktop\zealotry\server\routes\sockets\v1\index.js:69 io.sockets.emit('removeplayer', player); ^

ReferenceError: io is not defined at disconnect (C:/Users/Simon Kyger/Desktop/zealotry/server/routes/sockets/v1/index.js:43:9) at Socket. (C:/Users/Simon Kyger/Desktop/zealotry/server/routes/sockets/v1/index.js:28:36) at Socket.emit (events.js:159:13) at Socket.emit (C:\Users\Simon Kyger\Desktop\zealotry\node_modules\socket.io\lib\socket.js:140:10) at Socket.onclose (C:\Users\Simon Kyger\Desktop\zealotry\node_modules\socket.io\lib\socket.js:452:8) at Client.onclose (C:\Users\Simon Kyger\Desktop\zealotry\node_modules\socket.io\lib\client.js:233:24) at Socket.emit (events.js:164:20) at Socket.onClose (C:\Users\Simon Kyger\Desktop\zealotry\node_modules\engine.io\lib\socket.js:318:10) at Object.onceWrapper (events.js:254:19) at WebSocket.emit (events.js:159:13) at WebSocket.Transport.onClose (C:\Users\Simon Kyger\Desktop\zealotry\node_modules\engine.io\lib\transport.js:127:8) at WebSocket.internalOnClose (C:\Users\Simon Kyger\Desktop\zealotry\node_modules\uws\uws.js:199:17) at process.nextTick (C:\Users\Simon Kyger\Desktop\zealotry\node_modules\uws\uws.js:445:27) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickDomainCallback (internal/process/next_tick.js:218:9) [nodemon] app crashed - waiting for file changes before starting...

simon-kyger commented 6 years ago

init does ok because its being passed the io obj, but disconnect is only being sent the socket, not the entire io object.

simon-kyger commented 6 years ago

fixed in https://github.com/simon-kyger/zealotry/commit/a7fdfe4595636743bdb9582441e0f151a4747f55