Placeholder-Software / Dissonance

Unity Voice Chat Asset
71 stars 5 forks source link

Reconnecting #156

Closed pana-cc closed 5 years ago

pana-cc commented 5 years ago

Hello,

We have purchased Dissonance for one of our VR conference meeting apps and it is one of the best pieces of software I've seen in a while. We have other networked components internally using the "new unity networking" that's the raw UDP sockets, so I am following: https://dissonance.readthedocs.io/en/latest/Tutorials/Custom-Networking/ So far everything works great inhouse.

However with a previous VoIP solution we had moments where players disconnect and reconnect. For example when they put off an Oculus Quest, it sleeps, disconnects, then put it on and reconnect, resume the same session.

So my clients must be able to disconnect and reconnect at random. Could you provide some guidance how to approach this?

On the client side I do call this.Stop() on my implementation of BaseCommsNetwork when the client disconnects.

From that point on calling this.RunAsClient(default) again when the underlying network connection is re-established, throws the error:

DissonanceException: Error: Attempted to restart a ConnectionNegotiator after it has been disconnected! This is probably a bug in Dissonance, we're sorry! Please report the bug on the issue tracker

The clients work if they restart the app, so probably the server is somewhat fine. I can probably destroy and recreate the BaseCommsNetwork instance. But for me it would be better if it could be stop-ed and then restart-ed as my implementation registers channels. It is similar to the old unity transport layer. I would preffer to reuse the same instance to creating and configuring a new one every time the client reconnects.

Thank you,

pana-cc commented 5 years ago

Ok, this.Stop(), this.RunAsClient() should work. It turned out multiple instances of BaseClient are created and I mistreated them by sending events to old disconnected BaseClient instances.

martindevans commented 5 years ago

Wow, it's very cool that you're using the new Unity networking. Hopefully we'll support that soon (we're waiting for it to be developed a little more before releasing an official package).