Generate and submit a join token
How to form and submit a join token on a game server.
Read time 1 minuteLast updated 20 hours ago
To generate a join token, follow the same process that was introduced in Generate a login token. The part you will change is the payload portion of the token.
Join token - Payload
You can re-use the same serializable class you crafted earlier for use in login tokens to craft the payload for a join token. The two key differences are a different Vivox Action: Join, and the use of the To (t) field.Explanation | Example claims object |
|---|---|
| N/A | public class Claims { |
| N/A | public string iss {get;set;} |
| N/A | public int exp {get;set;} |
| Vivox Action | public string vxa {get;set;} |
| N/A | public int vxi {get;set;} |
| N/A | public string f {get;set;} |
| “To” channel to join | public string t {get;set;} |
| N/A | public string sub {get;set;} } |
Example join token
Claims loginClaim = new Claims{iss=testgames1234-aa12,vxi = 93000,vxa:join,exp=1600349400,f=sip:.testgames1234-aa12.030104_16.@tla.vivox.com,t=sip:confctl-g-testgames1234-aa12.1M2n31IoU45b.t1@tla.vivox.com};
Submit a join request
Vivox has structures to store a common set of parameters to many different request types. Utilize this in your next step, which is to craft your request, and issue it to the Vivox SDK to be sent to Vivox services. Create your join request in your game client and store any necessary parameters and theaccess_tokenIssue the request to the Vivox SDK from the game client.vx_req_sessiongroup_add_session *req;vx_req_sessiongroup_add_session_create(&req);req->sessiongroup_handle = vx_strdup("sg1");req->session_handle = vx_strdup("1M2n31IoU45b.t1");req->uri = vx_strdup("sip:confctl-g-testgames1234-aa12.1M2n31IoU45b.t1@tla.vivox.com");req->account_handle = vx_strdup("sip:.testgames1234-aa12.playerName@mt1s.vivox.com");req->connect_audio = 1;req->connect_text = 1;req->access_token = vx_strdup(_the_access_token_generated_by_the_game_server);
vx_issue_request3(&req ->base, &request_count);
Reminders
- Do not send identifiable playerName(s) to Vivox.
- must be unique across your entire game.
session_handle