Processing external callback-function in c++

Hello there,

I am currently struggling trying to process or even get data from a custom callback function. I am using the Photon-Framework from ExitGames.

This is what I have so far:

PhotonListener => separate class
PhotonClient => UObject
GameInstance => UGameInstance
LoginActor => AActor

PhotonClient uses PhotonListener to connect via ExitGames::Photon:PhotonPeer(*listener) to the server. I have to implement a custom PhotonListener as callback-interface that implements three function that get called by the Photon-API when events get passed back from the server to the client.

GameInstance instantiates the PhotonClient and LoginActor uses the reference to the GameInstance to send operations to the server and call the service() function in the Tick() function of the actor.

My problem now is that I have absolutely no idea how i can achieve that LoginActor gets informed when the callback functions implemented in the PhotonListener get called by PhotonApi nor how to extract the data provided by the functions.

For completeness I have included a link to my project: Dropbox - Error - Simplify your life

This is what I must achieve in general:

I hope someone can help me :slight_smile:

PS: Reference from ExitGames: http://doc-api.exitgames.com/en/onpremise/current/cpp/doc/html/a00083.html

Hi there,

as I am very insistent when something doesn’t work out as I intend I finally found a solution to my problem. I no longer follow the approach with delegates or events. I simply made a BaseHandler as an AActorComponent and then derive from that to an actually needed specific Handler attached to an Actor placed on the Map I actually loaded. This actor gets passed all the way trough the GameInstance, the PhotonClient and finally to the PhotonListener. If then an function in the PhotonListener gets called by the Photon API I handle that in my specific ActorComponent.

Don’t know if that is an elegant way to achieve what was needed but it still works.