Callback functions are not called

Hi,I am having really hard time to understand where is the call/ setup of the callback functions. I implemented all of the callback functions that I need but when I debug my code no callback function is called. Especially the connectReturn function that I relay on. The code that I execute is in a universal windows solution. When I am running the loadbalancing demo everything is working.

Do I need to setup something for universal windows project ?Do I need to configure or call some function to get the callback functions work ?

Thanks,Gabriel

0

Comments

Hi @Kaiserludi ,
Yes I call the service in the game loop, which currently is the only function that is called. Is there anything that I need to call or implement besides calling service, or it supposed to be called automatically ?

Well, I suppose that you call connect() itself, of course. Aside from that and the requirement to call service(), no other calls should be necessary to receive a callback for your connect attempt.Are you receiving any other callbacks or non at all? Not even debugReturn() when you set the debug level to 'INFO'?

You could open the LoadBalancing project, rebuild it and set a breakpoint in Client::onStatusChanged() do check if that function gets called.

Aside from that please compare your code with the one of the demo and look what you are doing different.

@Kaiserludi Tanks for the help!
I mean by calling additional stuff is, do I need to have the following references inorder for the callbacks to work?
ExitGames::Common::Logger mLogger;
StateAccessor mStateAccessor;
Output listener mpOutputListener;
The third one is just a writer to the console.

I tried to comment some lines inside the load balancing demo and the connect callback didn't call only when I comment the following line:
mStateAccessor.setState(STATE_CONNECTING)

I do understand the logic behide it, but I do not see where the reference of mStateAccessor is stored ? And how it knows that this is the state variable that should track the state ?

No, none of these need to exist in your project for the callbacks to get called.Having access to a variable or reference of type Logger that is called 'mLogger' is necessary for close that you want to be able to call EGLOG(), as the EGLOG macro relies on the existence of such a variable.The StateAccessor instance is managing the state of the demo itself, not of the Photon client. It's up to you how you want to handle the state of your own application.The OutputListener instance handles the demos output. It's up to you how your app handles its output.

I don't think that fiddling around with the StateAccessor will be of any help in figuring out what's wrong or missing in your code.

I would rather have a look at what the demo does with it's instances of LoadBalancing::Client.

By the way:How do you know that your callbacks are not getting called?Have you set breakpoints inside them? If yes, then are other breakpoints outside the call-backs getting hit?If you have not setup breakpoints, how else are you checking, if the callbacks are getting called? By checking if their output is printed? Maybe the callbacks are getting called and the real problem is just with the output code?

I assume you use the WindowsStore Client SDK. In that case it might make sense to download the Windows Desktop Client SDK and have a look at the demos inside that SDK as it ships with some additional demos that are not part of the WindowsStore SDK. Perhaps it helps to take a look at 'demo_basics'.

Thanks alot @Kaiserludi !
I tried the following recommendation and I didn't know that the windows sdk is for universal windows projects. Finally I copy/paste the whole code from the demo project and it worked, so probably it is something that I didn't see. Now I get to the callback functions but I cannot create room. Is there any reason for room creation failure (I tried it from the demo project and it did create the room)?

The Windows SDK is for classic Windows Desktop apps.The WindowsStore SDK is for UWP apps.However the Windows SDK has more demo projects. That's why I suggested that you would additionally to the WindowsStore SDK that you already downloaded, also download the Windows SDK, so that you could take a look at the other demos. I did not suggest that you should use the Windows SDK for developing UWP apps.

I am a bit lost now.You could not get the callback functions to work without copying the full demo source to your project. Now you did indeed copy over the whole demo source and the callbacks are getting called? is that correct?Next you say that you can not create rooms with your project, but that it does work for the demo project. How can that even be possible if at this state your project is basically just a copy of the demo project?

Yes, I copied the implementation of the network listener inside my project and it is working.I switched the libraries of windows store sdk to the simple windows sdk and it started to create rooms.I didnt change anything else. Currently I am with the windows sdk and everything seems to work.

Hi @Kaiserludi . Thanks a lot for all of your help! Currently everything is working as expected. Probably I did something wrong. If I'll find the reason I'll share it for further investigation but currently it works with the windows store sdk. I am sorry for bothering you. Much appreciated. 🙂