Cant connect to Photon Cloud

Lucky
Lucky
edited May 2013 in Native
I use Photon Cloud Objective C SDK for an iOS game.

I create a class implement <EGLoadBalancingListener> and handle all methods as well.

I create a EGLoadBalancingClient* peer;
property.

I have call initClient and then connect, the connect method return YES.

Then I call opCreateRoom but it always failed.

This is the debug info:

Debug Return 1 - 2013-05-12 12:24:03,412756 ERROR PeerBase.cpp opCustom() line: 235 - failed - call Connect() first!

--> I have call Connect already.

Please help?

Or show me where is the documentation for iOS Objective C implement?

Thank you.

Comments

  • Ok, I found out why.

    Because it take a while to connect to server, so if I call create room right after connect then it will fail.
  • Now I got another problem,

    When I call opJoinLobby, I got this message on OperationResponse event:

    On Operation Response : -3 - 229 - Not authorized

    Trying to figure out but if somebody face this before please suggest solution.

    Thanks.
  • OK, I figured out also.

    Because I want to take care of every events that occurs with Photon Cloud, i.e. when app connect, authenticate, join room ... etc. so I override all events in EGLoadBalacingClient, EGLoadBalancingPeer ...

    Thats cause the problem, because EGLoadBalancingClient also handle and execute method base on event data its got. And the opAuthenticate method in EGLoadBalancingClient was code to throw exception, then I can not execute opAuthenticate method to authenticate my app.

    The solution is then not handle these events: onOperationResponse, onStatusChange ... just leave it to EGLoadBalancingClient as it is.

    I have to think to create my own Custom_EGLoadBalacingClient if I want to take control of all stuffs.

    Thank all (even I dont get any response to this thread :)
  • Hi Lucky. Sorry, but on Sundays we are rarely looking into the forum.

    You should always wait for the appropriate callbacks, until doing the next steps. The loadBalancing demo inside the client SDK should be a great help when it comes to workflows.

    For inheriting there are several options:
    1. Don't inherit, but just use an EGLoadBalancingClient instance.
    2. Inherit from EGLoadBalancingClient and enhance it and use that enhanced subclass then.
    3. Inherit directly from EGLoadBalancingPeer, if you not only want to enhance EGLoadBalancingClient, but actually want to change existing behavior. In that case its probably better to copy and paste or to modify the existing implementation from EGLoadBalancingClient than to inherit from it just to try to deactivate one of its core-features, which is handling certain stuff like server-switches or authentication internally.