how to intercept Operations in plugin code?

Hi all and thanks for advice!

I am extending LoadBalancing with a plugin, using self-hosted v4 running on machines at home, and clients running PUN2. Clients are sending PhotonNetwork.RaiseEvent to the server.

Just a bit confused about how to get my plugin to intercept the operations. I understand there is an interface I must implement, I think it's the IOperationHandler, is this correct? Can I add this on the plugin class as MyPluginClass : PluginBase, IOperationHandler? Or maybe I am not understanding something important. Just want to be sure how it works and how it should look. Thank you :)

Comments

  • JohnTubeJohnTube mod
    edited March 8
    Hi @TylerM,

    Thank you for choosing Photon!

    Plugins do not support custom operations unless of course you want to change actual Plugins API / handler / invoker...maybe that's useless if you could actually directly modify the game server code.
  • TylerMTylerM
    edited March 9
    @JohnTube Perhaps I should have been more clear, I am not trying to implement custom operations. I am just trying to intercept PhotonNetwork.RaiseEvent in the plugin. I think maybe it's a bit confusing because it's called an 'event' when really this one is a built-in operation. I know that it is possible but I just don't understand the method for intercepting the RaiseEvent in the plugin code.

    I was told by a mod - 'The PhotonNetwork class has a RaiseEvent method. This is calling: NetworkingClient.OpRaiseEvent, which is the exact same method that's shown in the docs for the Realtime API'

    Thanks
  • hi, @TylerM

    then you have to override IGamePlugin.OnRaiseEvent method in your plugin. Easy :)

    best,
    ilya
  • here and here.
  • @JohnTube @chvetsov Thanks very much both of you
Sign In or Register to comment.