AccelByte lobby services provide continuous connection between the players and the game by using WebSocket. WebSocket ensures reliable, real-time data transfer by allowing two-way communication between the server and clients. Our lobby includes the following services:
- Presence enables players to see what other players are doing in real-time. This feature is critical in online multiplayer games, because player interactions rely on knowing which players are available.
- Party is used as the basis for multiplayer matchmaking. The party can be integrated with other lobby services such as presence, friends, and chat, to enrich the multiplayer experience.
- Friends lets players connect and interact with each other. AccelByte supports both in-game friends and platform or launcher level friends. In-game friends can chat and play together within a game title, whereas platform level friends allows players of different games to interact with each other.
- Chat enables real-time text based communication in-game. We support global, party, and individual chat.
- Matchmaking is responsible for matching multiple players based on the selected matchmaking channel configurations.
Connect to Lobby
Before you can use social services, you must set up a lobby connection by using the command below.
Once you have set up a lobby connection, you will be able to use other Social features such as user presence.
Handle the Connect / Disconnect Event
This feature notifies the game of any changes to the connection to the Lobby server. The SDK already provides an auto-reconnect mechanism, but when the auto-reconnect times out you must reconnect manually.
Block a Player
Blocking allows players to restrict other players from interacting with them. When one player blocks another, both players are prevented from interacting with each other in the following ways:
- Adding the other as a friend. If the players are already friends, they will be unfriended.
- Sending or receiving messages to or from each other.
- Seeing each other’s messages in global chat rooms.
- Inviting each other to parties.
- Meeting each other in matches.
- Being in the same party, unless they were both invited by a 3rd player. Please note that should this occur, the blocking and blocked players will be able to interact with each other in the Party chat.
- Inviting each other to join groups.
- Seeing each other’s player profile in group member lists.
Blocked players cannot see the profile of the blocking player, and blocked players receive no notification regarding the block. See the tutorials below to implement player blocking using the SDK.
Blocking a player can be done by calling BlockPlayer(userId, callback). The callback from this method will return the blocked player’s user ID.
Listen to Player Blocking Events
Sometimes the game needs to know if a player is being blocked by another player. Blocking events can be tracked by subscribing to the PlayerBlockedNotif event. The event will be raised on the blocked player side and will pass data that contains the blocking player’s user ID and the blocked player’s user ID.
Unblocking a Player
Unblocking a player can be done by calling the method UnblockPlayer(userId, callback). The callback from this method will return the unblocked player’s user ID in the Value field.
Listen to Player Unblocked Events
Just like the Player Blocked Event, the PlayerUnblockedNotif event will be raised on the unblocked player’s side, and will pass data that contains the unblocking player’s User ID and the unblocked player’s User ID.
Get List of Blocked Players
To retrieve the list of currently blocked players, call the GetListOfBlockedUser method. This method has a callback that returns an array of BlockedData that contains the blocked players’ User IDs and the timestamp for each block.
Get List of Blocking Players
To retrieve a list of players that have blocked other players, call the GetListOfBlocker method. This method has a callback that returns an array of BlockerData that contains the blocking players’ User IDs and a timestamp for each block.
- Check out the API Reference for more information about Lobby services.