itisnajim / SocketIOUnity

A Wrapper for socket.io-client-csharp to work with Unity.
MIT License
393 stars 67 forks source link

Socket.io process keeps running despite Unity editor being stopped. #11

Closed DaveKap closed 2 years ago

DaveKap commented 2 years ago

After successfully connecting to a test server with the example client code via the Unity editor in run mode, something peculiar happens after stopping. Unity_nZF8C1HejG For some reason the socket.io process just keeps going, despite the fact I stopped the program. I have to kill Unity to make this stop. I tried to add this code, which should kill the socket when the editor stops, but that doesn't seem to be the case:

    private void OnApplicationQuit()
    {
        socket.Disconnect();
    }
ThimoDEV commented 2 years ago

Have you tried Disconnecting the socket in the OnDisable or OnDestroy method? I don't know if OnApplicationQuit is the best method to use for the editor play mode.

itisnajim commented 2 years ago

duplicated https://github.com/itisnajim/SocketIOUnity/issues/5