What is the callback flow when the loadbalancing client connect method is called?
Options
Best Answer
-
Hi @CASBraga.
Client::connect::()
starts establishing a connection to a Photon server.
The connection is successfully established when the Photon client received a valid response from the server. The connect-attempt fails when a network error occurs or when server is not responding.
A call toconnect()
starts an asynchronous operation. The result of this operation gets returned through theListener::connectReturn()
callback function.
If this function returns false, then the connect-attempt has already failed locally.
If it returns true, then eitherListener::connectionErrorReturn()
orListener::connectReturn()
will get called.
The operation was successful, when Listener::connectReturn() got called with errorCode==0.1
Answers
-
Hi @CASBraga.
Client::connect::()
starts establishing a connection to a Photon server.
The connection is successfully established when the Photon client received a valid response from the server. The connect-attempt fails when a network error occurs or when server is not responding.
A call toconnect()
starts an asynchronous operation. The result of this operation gets returned through theListener::connectReturn()
callback function.
If this function returns false, then the connect-attempt has already failed locally.
If it returns true, then eitherListener::connectionErrorReturn()
orListener::connectReturn()
will get called.
The operation was successful, when Listener::connectReturn() got called with errorCode==0.1 -
Hi @Kaiserludi
Thanks for the swift answer. Is there any reason neither Listener::connectReturn() nor Listener::connectionErrorReturn() would not be called during the connection process? I ask this because I have an implementation of both in my LoadBalancing::Listener (along with the client, warning and server error functions) but there is no call to them (strings initialized inside of them are passed to my GameInstance class to be printed; using UE4 btw). I know Client::connect() returns true when called. I also know it is not a network issue as the particle demo works fine and I tested a demo that comes with the SDK and also got connection to the photon cloud.
cheers!0 -
Hi @CASBraga.
Are you sure that you are passing the correct listener instance to the Client constructor?0 -
Edit: removed my own code since it is no longer necessary.
To get a call to connectReturn and any other function from the Listener just make sure to callClient::service()
after you callClient::connect()
. That was my problem. Once service() was called in tick(), the test project connected. So yes, nothing to do with the Listener... just good old fashioned lack of attention when reading the documentation.
Cheers!0