Thanks for the great work you've done porting the SmartFox API to Unity, and I hope I can contribute to the effort a little. I'm using the just released 1.0 version.
My NUnit unit tests have exposed a problem with the event handling architecture. All is OK until I try to open 2 SFS client connections. This is something I do regularly with actionscript (I use fluint there), for example to make sure the system responds correctly to an attempt to login with the same username, or to run a turn based game extension through its paces.
Of course the problem is that all the handlers added to a static delegate in SFSEvent get called whenever an event occurs on either connection and there is no way to infer which client is responsible for the event.
Would it not be better to make the event delegates public non-static members of SmartFoxClient so you could...
Code: Select all
SmartFoxClient clientA = new SmartFoxClient();
clientA.OnWhatever += OnWhateverA;
SmartFoxClient clientB = new SmartFoxClient();
clientB.OnWhatever += OnWhateverB;
basically the same way its done in Actionscript.
I guess the current way is OK if you only ever open a single client connection, but could it also cause problems if you open 2 unity windows in the same browser. I know very little about how the Unity plugin and the mono virtual engine work, but is it possible that the two plugins share the same virtual engine, memory, and that there is only one instance of each static delegate per browser?