doghappy / socket.io-client-csharp

socket.io-client implemention for .NET
MIT License
729 stars 125 forks source link

socket io dispose method #253

Open SachinTichkule opened 2 years ago

SachinTichkule commented 2 years ago

when socket IO dispose method need to call

Example : I working on unity game engine, so I use in ApplicationQuit() before call i also use DisconnectAsync before disopse, but i got null reference exception, i don't know where gonna i call without getting null.

doghappy commented 2 years ago

Maybe you need to wait for DisconnectAsync to finish before calling Dispose()

SachinTichkule commented 2 years ago

@doghappy you want to say that call dispose in disconnected callback listener. am I right ?

hxghxg527 commented 2 years ago

firstly i call await socketIOClient.DisconnectAsync() to disconnect socket, then i call await socketIOClient.ConnectAsync() to reconnect socket. but socketIOClient.OnConnected += SocketIoOnConnected can not listener the connect info. how can i disconnect socket and reconnect socket? anyone can help me? thank you. @doghappy