Closed VrTech closed 2 years ago
I found the same issue and it happens exactly every 30 seconds
I had the same issue. It was an error in one of my custom events, so my Unity client was automatically disconnected. Try to remove all your event listeners. And check also the pingTimeout and pingInterval on your server.
Same thing, it just keeps reconnecting even if everything is ok.
I found that setting the pingInterval
to 500 resolves this issue.
It looks like the Github project for the SocketIoClientDotNet test server does this as well https://github.com/Quobject/SocketIoClientDotNet/blob/f7e768793abfda7f4660d2f5b0260a325c0c2487/TestServer/server.js#L32
It's actually working! Thanks mate!
Where can i set the pingInterval in my client (C#) script?
I think you can't, the pingInterval is defined by the server, not the client.
I was having a similar issue (different cause) and thought it might be worth posting here in case others stumble upon this.
I have a VueJS App that contained a link like so:
<a href="bitcoincash:qrks5vefcxzjrmadcn5e3vthkp65lh4npvd0gw3qcs">Pay</a>
Clicking this link would force my SocketIO client to disconnect (probably considered a "navigate away" by the Socket IO client library - suspect other URL schemes would behave the same).
To mitigate, just add target="_blank"
to your hyperlink so that the hyperlink is opened in a new window (thus avoiding Socket IO considering this a "navigate away" action).
I found that setting the
pingInterval
to 500 resolves this issue.It looks like the Github project for the SocketIoClientDotNet test server does this as well https://github.com/Quobject/SocketIoClientDotNet/blob/f7e768793abfda7f4660d2f5b0260a325c0c2487/TestServer/server.js#L32
not working. I tried this with my Node code, same issue...
Do you know why Unity keeps disconnect and connect to socket.io ? Thank you