node-json-socket icon indicating copy to clipboard operation
node-json-socket copied to clipboard

connection don´t close when server program stopped

Open solick opened this issue 9 years ago • 1 comments

Hi,

just encountered a strange problem:

I have a server-client connection via json-socket. Communication is running fine. I added on client side a method to connect again to server once the "close" event or "error" event has raised. The connection establish again but now i receive the packets twice on client side. I can reproduce this and each time i stopp and restart the server, the number of received packages increase by one. I added a destroy function to the json-socket but this don´t help. Any suggestions?

KR Solick

solick avatar Mar 23 '15 12:03 solick

I tried a couple of thinks and finally found out, that the message event will not be deregistrated somehow. Making sure, that the message event will only be registered one (eg. by setting a flag) solves my problem. But i´m not sure if this is a bug or a feature ;)

solick avatar Apr 04 '15 13:04 solick