Custom application init/response objects

Hello!

I have a question about init/response objects when connecting to custom server applications:
When connecting your PhotonPeer, you can add a custom object. This will be received on the server side: the InitRequest object will contain the custom object in the InitObject field.
I was wondering if you can send a custom object as a response to the InitRequest. It seems there is a ResponseObject field in the InitRequest object just for this purpose, but how do you access this data client side?
I have a PhotonPeer and an implementation for the IPhotonPeerListener and I guess the photonPeerListener should be able to access the custom response object when the PhotonPeer connects, but I couldn't figure out how.

It would be nice to be able to provide some initial state when connecting, or to communicate a reason when declining a connection using this method.

Is it possible to do this with Photon and custom server applications?

Kind regards,
Gydo

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Gydo_VROwl,

    Thank you for choosing Photon!

    I think InitRequest / InitResponse are not exposed in client SDKs and are used internally.
    I will need to double check with my colleague @Tobias.

    Is it possible to do this with Photon and custom server applications?

    I think you should do this in authenticate operation rather than init.
    Either use an available return parameter or make a new one.
  • I have the same question. Can I get a response from the server (to the client) in InitRequest?
  • The answer is the same as earlier: There is currently no way to send custom data in an init-response.