itisnajim / SocketIOUnity

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

Unconnected socket cannot be stopped (unless disposed) #63

Closed jeffrson closed 1 year ago

jeffrson commented 1 year ago

An unconnected socket (destination unavailable) keeps trying to reconnect, even if .Disconnect(Async) had been called. So it would connect as soon as the destination is available, which it shouldn't because of .Disconnect.

Such it is hard to "pause" a connection without destroying it completely (.Dispose).

Reason is, that .Disconnect only ever does something when the Connected property is true.

itisnajim commented 1 year ago

https://github.com/doghappy/socket.io-client-csharp#options set Reconnectionto false

2nd time I answer you from the Readme, see https://github.com/doghappy/socket.io-client-csharp and https://github.com/itisnajim/SocketIOUnity good luck

jeffrson commented 1 year ago

Well, while I could admit that I had not paid enough attention to "Check the 'Samples~' folder and socket.io-client-csharp repo for more usage info." for the first issue (which is still not obvious to me though, because of "Supports socket.io server v2/v3/v4"), this one is absolutely different.

I don't want to set Reconnection to false - I just don't want it to reconnect after I called Disconnect. Is there any way to change Reconnection after new SocketIO? Cannot find it in the Readme.

Also, it does not make much sense that it behaves differently if one calls Disconnect while it is connected or not. In the first case it does not try to reconnect, in the second it does. I think this is already understandable from the first post in this issue.

Therefore this issue should be reopened because it's fairly valid.