Where does SocketServer.PeerBase.SendEvent go?

Options
escjosh
edited February 2012 in Photon Server
Client.Photon.PhotonPeer (Unity3D) has no OnEvent. What happens when I call SocketServer.PeerBase.SendEvent against a unity client?

I see that IPhotonPeerListener has an OnEvent method, but PhotonPeer doesn't. I'm coming from the S2S API where both peers are the same type and they both have SendOperation/OnOperation and SendEvent/OnEvent.

Thanks

Comments

  • Tobias
    Options
    Oh. Now I got what you're looking for.
    The client side is different (as you noticed). There, your game implements the callbacks, as defined by IPhotonPeerListener. The PhotonPeer (and it's deriving classes) need a IPhotonPeerListener implementation to call the callback methods on that.
    Say, you implement IPhotonPeerListener in MyClient, then you pass a instance of that to the constructor of PhotonPeer.
    The examples show this.
        public class Game : IPhotonPeerListener
        {
    
            public void OnEvent(EventData photonEvent)
            {
                    // event reaction
            }
    
            // in some method:
            this.Peer = new LitePeer(this, this.protocol);
    

    Have a look at the client SDK's samples.
  • :oops: Sorry, Tobias. I was confused in a way that I can't even imagine. All I remember now is having about 6 copies of visual studio open, so that's probably where I went wrong :lol: . Weird.

    Anyway, your explanation makes sense and I like the listener approach.

    Thanks!