How to create real-time Lobby connection using WebSDK?

I’m working on spinning up a headless client in typescript using the WebSDK. I’d like to test the matchmaking flow, and in order to do so I need a Lobby websocket connection. How best to go about that?

Thanks,
Nick

Hi @njupshot,

Your WebSocket client will need to connect to wss://studio-gamenamespace.prod.gamingservices.accelbyte.io/lobby/, and you must pass Authorization: Bearer <user_token> in the header.

For reference, in Unreal SDK, we also send optional headers, but you can ignore them if you don’t want to use them:

  1. Entitlement: entitlement token, used for verifying if the user is allowed to connect to the lobby.
  2. X-Ab-Platform: platform type, e.g., Steam, EOS, PSN.
  3. X-Ab-Platform-User-ID: platform user ID
  4. X-Ab-EnvelopeStart: LbS, if the message starts with this key, the lobby message is being sent in chunks.
  5. X-Ab-EnvelopeEnd: LbE, the end of the lobby message chunk.

After you create a match ticket, you will receive the following event topic.

  1. OnMatchFound
  2. OnMatchmakingStarted
  3. OnMatchmakingTicketExpired
  4. OnMatchmakingTicketCanceled

Please let me know if this answers your question.

Thank you @Damar I’m getting further.

Once the lobby connection is open, I create a matchmaking ticket. It’s at this time I’d expect to receive the OnMatchmakingStarted message, but that doesn’t come. I only see this message come through:

type: connectNotif
loginType: NewRegister
reconnectFromCode: 5000
lobbySessionID: 83bce3d7721c4b29a3cecd4544190b2f
sequenceID: 1720793636
sequenceNumber: 1

…additionally, I have a dedicated server running who receives the following after sending the “ready” message:

{
“MessageID”: “”,
“Code”: 200,
“topic”: “DSHUB_CONNECTED”,
“payload”: {
“connectionId”: “2c5f971ee0ed46528e6b45d7fa98a5fd”
}
}

…is it expected that the Hub sends JSON while the Lobby sends messages in a newline delimited format?

Thanks

Hi @njupshot,

We found an issue with AMS in your namespace. I contacted our internal team, and we have already applied a fix to your namespace. Please go to your AMS page and ensure you can see the AMS account there. Let me know if you are still encountering any issues.

Also, yes, it is expected that DSHub and Lobby have different formats.

Thank you Damar, I’m now receiving both a “MatchFound” and “OnSessionInvited” message both of which contain encoded payloads. Is the client meant to decode these payloads? What’s the next step?

Thanks!

Hi @njupshot,

Yes, the game client will need to decode it first, which was encoded in Base64. After you decode it, it will result in a JSON format.