internals:sbl-websocket-messages

SBL Websocket Messages

A message always starts with a 4-byte Big Endian integer denoting the a message counter, which starts at 0 and runs per connection, not per room/server. Counters are seperate for client and server messages.

After that counter, data is serialized in the the MsgPack format. Messages contain multiple concatenated MsgPack values. Unpack objects one by one. The table below describes the values in the order they appear.

Value Type Description
Message Type Integer 2 (Request), 3 (Reply), 4 (Updates), 5 (???) or 6 (???).
Function ID Integer For Types 2 (Request), 3 (Reply) and 4 (Updates) only. Defines the Payload for the message. See below.
Error Code (?) Integer For Type 3 (Reply) only. 0 if the Request was successful. See below.
Payload Any A data structure corresponding to the message's Function. See below.
Acknowledgement (?) String For Type 3 (Reply) only. Always “OK”?

Flow

Data Structures

User Properties

Key Type Content
ua Array
Index Type Content
0 Integer ??? Always 0.
1 Array User Info
ub Array
Index Type Content
0 Integer ??? Always 2.
1 Array User Ready State

User Info

Index Description Type Content
0 Friend ID Integer This user's Friend ID.
1 Name String This user's player name.
2 Rank Integer This user's current rank.
3 Profile Card Integer Internal card ID of this user's profile card.
4 Profile Card Idolized Boolean Whether to show the idolized image for this user's profile card.
5 Title Integer Internal title ID of this user's set title.
6 SBLSBL: Short for "SIFAS Big Live". A monthly co-op event where 20 players go for Group Goals and fight for MVP Titles.➔ Learn More Award Integer Most recent earned SBL award (ID from m_coop_live_award) of this user.
7 Formation ID Integer The Formation this user has currently selected.
8 Live Power Integer Live Power of this user's currently selected Formation.

User Ready State

Index Description Type Content
0 Checked In Boolean Whether this user has finished the lobby countdown and has begun the SBL start sequence.
1 Started Loading Boolean Whether this user's app started loading Live data.
2 Ready To Start Boolean Whether this user's app finished loading Live data and is ready to begin the Live.
3 Live Finished Timestamp Integer Unix timestamp (in seconds) of when the user finished their Live, or 0 if they haven't yet.
4 Waiting For Results Timestamp Integer Unix timestamp (in seconds) of when the user left their solo results screen and joined the wait for the group results, or 0 if they haven't yet.

Room Properties

Key Type Content
249 Boolean Whether clients should clean up their cache after leaving the room. (?)
250 Array of Strings Array of WSNet room filter property names (always [“:ra”,“:rb”], available as keys in this object)
251 Boolean Whether the room has been removed by WSNet. (?)
252 Integer Current player count.
253 Boolean Whether the room is visible to possible joiners.
254 Boolean Whether the room is open. (?)
255 Integer Maximum player count.
:ra Integer Unknown WSNet room property - maybe just room type?
:rb Integer Live ID of the song of this room
:room_number Integer Unique room ID assigned by WSNet
ra Integer
Index Type Content
0 Integer ??? Always 1.
1 Array Room Info

Room Info

Index Description Type Content
0 Room ID Integer Unique Lobby ID. Different from :room_number above.
1 Room Goals Arrays of Integers Array containing the room goals chosen for this lobby (IDs from m_coop_live_room_mission).
2 Created Timestamp Integer Unix timestamp (in seconds) of when the room was created.
3 Countdown Timestamp Integer Unix timestamp (in seconds) of when the countdown for the room was started.
4 Live Start Timestamp Integer Unix timestamp (in seconds) of when all players were ready and the Lives were started.
5 Results Collected Boolean Whether all players have finished their Lives (or have timed out). If true, their results have been aggregated and are now available.
6 Error Code Integer Non-zero if an error occurred in the room.

Requests

253: Broadcast

Sends a message with a given type/function to all players in the room (including the sender themselves). There is no reply.

Payload: Map
Key Description Type Content
244 Broadcast Function Integer The Function the broadcast will have.
245 Broadcast Payload Any The Payload the broadcast will have.
246 ??? Integer ??? Always 1.
247 Broadcast Message Type Integer The Message Type the broadcast will have.

See the relevant section for a Broadcast Function to see what the Payload should be.

254: Leave Room

Sent to notify the server and other players of the client leaving the room.

Payload: Nil

Replies

254: Leave Room

Payload: Map (empty)

Updates

200: Stamp Broadcast Received

Payload: Map
Key Description Type Content
245 Broadcast Payload Map
Key Description Type Content
0 ??? Integer ??? Always 1.
1 ??? Integer ??? Always 0.
2 ??? Integer ??? Unknown number.
4 Stamp Info Byte Array MsgPack-ed 2-element array that must be unpacked seperately.
Index Type Content
0 Integer Friend ID of the sender.
1 Integer Stamp ID (same order as in the in-game menu, 1-indexed).
5 ??? Integer ??? Always 1.
254 Broadcast Sender Integer In-Room User ID of the sender.

253: Property Update

Messages sent to all other players if a player updates a Room Property or User Property structure.

Payload: Map
Key Description Type Content
251 Updated Properties Map Partial Data Structure containing only the keys whose values have changed.
253 Updated Object Integer 0 if the Room Property structure, or a In-Room User ID if their User Property structure was updated.
254 Updating User Integer In-Room User ID of the user who caused the update (the user themselves for User Property updates, or the room host for Room Property updates).

254: Player Leaves Room

Payload: Map
254 Leaving User Integer In-Room User ID of the user who left.

255: Player Enters Room

Payload: Map
249 User Properties Map User Properties of the new player.
252 List of In-Room User IDs Array of Integers In-Room User IDs of all players currently in the room, in seemingly random order.
254 Entering User Integer In-Room User ID assigned to the new player.

Error Codes

Code Name Description
0 None No error.
1 NoRandomMatchFound There are no rooms matching the search criteria.
2 RoomClosed The room has been closed.
3 RoomMemberOver The room is full.
4 ShortageMember The SBL is supposed to start, but there are not enough players (at least half the room limit), so the SBL has been cancelled and the room will be closed.
5 OutOfDate ???
6 Unknown ???

Contributors to this page:
internals/sbl-websocket-messages.txt · Last modified: 2022/08/13 11:37 by Suyooo