TODO: Work-around for netcode.io browser connect callback
Closed this issue · 2 comments
The callback for client.connect in the netcode.io browser extension takes a single error value which is either null or an Error. Originally I had taken this to mean that a null error meant successful connection, but it seems this is not the case - the callback immediately triggers with a null error even if there is no server to connect to and the connection times out (it times out AFTER the connect callback is triggered)!
This quirk carries into Unity-Netcode.IO by extension, but I think it may be worth implementing a workaround so that the connect callback is a little more intuitive - potentially, once the connect callback triggers from the JS side, the Unity side then sits and polls the QueryStatus function of the client until the status is either Connected (in which case it THEN triggers the connected callback) or something other state indicating failure (in which case it triggers the connection failed callback).
Can we maybe work this out with the browser netcode.io? If small changes would make that better, talk to the owner of that repo and she can help you.
Yeah, you're right. I'll close the issue here for now and bring it up over there.