Is there a way to get connection in ConnectRequest?

Options
I'm trying to build the link between connection and players similar to that described here: https://doc.photonengine.com/en-us/bolt/current/demos-and-tutorials/advanced-tutorial/chapter-3

But I need the users GUID info that passed with token in ConnectRequest. Is there a way to get the BoltConnection in ConnectRequest?

Or is there another recommended callbacks that both has access to connection and token? Similar to " SceneLoadRemoteDone(BoltConnection connection, IProtocolToken token)" but I need it to be called before loading the scene.

Thank you!

Comments

  • ramonmelo
    Options
    Hello @SPF ,

    First, take a look here: https://doc.photonengine.com/en-us/bolt/current/connection-and-authentication/accept-refuse-connection

    You will see that in the "ConnectRequest" callback, you receive an "EndPoint" and "Token", this token reference is the same token sent by the client when starting the connection with the server, called "ConnectToken", that you pass, for example, when invoking "JoinSession" or "JoinRandomSession" on the client.

    Using this Token you can pass any information, including the GUID.

    --
    Ramon Melo
    Photon Bolt Team
  • SPF
    SPF
    edited November 2020
    Options
    @ramonmelo Thank you. That's what I did too. But my problem is that at this point(in ConnectRequest), the connection is not built yet so there's no access to connection.

    My goal is to link the GUID with connection, so is there a place that you recommend that I can do this? (maybe a callback that you can get access to tokens and also to connection at the same time)

    It would be good if "Connected" method provides access to tokens. I found this property "connection.AcceptToken", but it's null when I tried to reach it.
  • ramonmelo
    Options
    @SPF ,

    You need to look at the "ConnectToken": https://doc-api.photonengine.com/en/bolt/current/class_bolt_connection.html#ad10179c878eea340d10f59b8f7697680

    Please, read the link I sent on the other post, it describes what you need to know.

    If you want a reference to a "BoltConnection", so you need to accept the connection endpoint and wait for the "Connected" callback. The Token used by the client to join the session will be available at the "ConnectToken" property.

    --
    Ramon Melo
    Photon Bolt Team
  • SPF
    Options
    @ramonmelo Of course I've read everything you sent. Finally I ended up using "SceneLoadRemoteDone" to get access to connection and token at the same time. Thank you!