Answer the question
In order to leave comments, you need to log in
How to overwrite a socket in nodejs?
I started to learn nodejs, I'm making a simple game server and I want to implement a reconnect to the game.
There is an array with players players, when a new player is connected, I write its socket to the player players[i].connection = socket so that later it would be easy to send messages to everyone. When disconnecting, I do not remove the player from the array, but simply set the status to disabled. When reconnecting, I save a new socket for the player players[i].connection = socket, but after that, if I try to send something players[i].connection.write(...) does not work.
What am I doing wrong? Maybe you need to somehow close / delete the previous socket?
Thanks
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question