PhotonNetwork and OnOperationResponse

Options
Hello All!

I created an Photon Application about 2 years ago connecting straight to the Lite Application and using Unity and the OnPremise Server

In my Unity script, I would just created a function such as

void SendToPhoton()
{
var parameter = new Dictionary<byte, object>();
parameter.Add((byte)1,"HelloWorld");
this.Peer.OpCustom((byte)50, parameter, true);
}

And on the OnPremise server, the Lite Application, I modified the LitePeer.cs file to check the OperationCode and then send a Response back to the Client using the SendOperationResponse with a package. The Client will then do a switch on the return OperationCode on the function callback OnOperationResponse and it will do it's thing.

I have decided to upgrade the project to use the LoadBalancing project, which in turn will run an GameServer(s) ( using the Lite Application )

Seems pretty straight forward.

I used to use "PhotonPeer" but now I'm trying to use "PhotonNetwork" and I'm totally confused where I cannot figure out how to send back a "OnOperationResponse"

Is there a way to create custom OperationCode in the LoadBalancing project and have the Client fire the callback? I feel I'm overlooking something really basic. Truthfully, I may not be asking the question correctly.

I guess I am asking if there is a default callback on the Client that is fired each time ANY message is sent back that I can parse and do my switch statement on it.

Thanks for any and all suggestions.





Downloading the new version,

Comments

  • Tobias
    Options
    When we started PUN, we didn't expect someone to extend it, so the capability to have callbacks for operations isn't exposed. You could say it's one layer below the main classes of PUN.

    The LoadBalancing API is a better fit.
    Can you give us some feedback why you switched to PUN? Maybe we can work out what's missing for you.

    In PUN, there is the NetworkingPeer. In that, you can find OnOperationResponse. This is where all operation-responses go to.
    You could add a callback for all operations (or those in your code range) here.

    I guess we can add support for Operation Response callbacks but I would like to get it right, so it's not short-term.