Photon socket server abstraction

Options
fenderbender
edited August 2013 in Photon Server
Hello fellow programmers. I am using photon socket server for our project and been quite delighted with the results. But there is a one problem which I could not solve and I am hoping for your help. On the Server2Server communication everything is done with photon's native EventData class and its SendTo method. The source code was not abstract and was lacking flexibility, so I decided to make my own EventData class which will eventually use photons class. The way I thought about it was to implement IEventData interface and its methods. But I was quite surprised that this interface did not have the actual sendTo method and now I am stuck. I have my EventData class, it has a OperationCode and dictionary to be sent. I will be thankfull for any help about this matter.

Comments

  • Tobias
    Options
    I will move this topic to the server forum. This question is above my head (being the client dude) but my colleagues will help.
  • Thank you. My bad
  • You need a peer (or a list of peers) to which you can actually send the event data - so the SendTo() method for your EventData class should look like this:

    [code2=csharp]public void SendTo(PeerBase peer, SendParameters sendParameters)
    {
    peer.SendEvent(this, sendParameters);
    }

    public void SendTo(List<PeerBase> peers, SendParameters sendParameters)
    {
    ApplicationBase.Instance.BroadCastEvent(this, peers, sendParameters);
    }[/code2]

    Hope this helps!
  • Thank you it really helped!