Messages

Request

Envelope message for any Live API request. This allows a single uniform data structure for requests to be made and for the game to receive them. Specifically, there is only one possible action per request. You can request an acknowledgement of your request by setting withAck to true.

Acknowledgements will come in the form of a Response message. More information can be found with that event.

A single example to create a CustomMatch_JoinLobby request in python is as follows:

  req = Request()
req.customMatch_JoinLobby.roleToken = "<some token>"
req.withAck = True
  

Message Properties

Field NameTypeTagDescription
withAckbool1Receive an acknowledgement of the request having been received.
preSharedKeystring2Preshared key to use with the request. Only necessary if the connecting game has a preshared key specified through cl_liveapi_requests_psk.
actionsoneof-Action of Request (oneof options below table)

oneof Options

Custom Match specific requests (reserved 10 -> 30)

Field NameTypeTagDescription
changeCamChangeCamera4ChangeCamera message.
pauseTogglePauseToggle5PauseToggle message.
customMatch_CreateLobbyCustomMatch_CreateLobby10CustomMatch_CreateLobby message.
customMatch_JoinLobbyCustomMatch_JoinLobby11CustomMatch_JoinLobby message.
customMatch_LeaveLobbyCustomMatch_LeaveLobby12CustomMatch_LeaveLobby message.
customMatch_SetReadyCustomMatch_SetReady13CustomMatch_SetReady message.
customMatch_SetMatchmakingCustomMatch_SetMatchmaking14CustomMatch_SetMatchmaking message.
customMatch_SetTeamCustomMatch_SetTeam15CustomMatch_SetTeam message.
customMatch_KickPlayerCustomMatch_KickPlayer16CustomMatch_KickPlayer message.
customMatch_SetSettingsCustomMatch_SetSettings17CustomMatch_SetSettings message.
customMatch_SendChatCustomMatch_SendChat18CustomMatch_SendChat message.
customMatch_GetLobbyPlayersCustomMatch_GetLobbyPlayers19CustomMatch_GetLobbyPlayers message.
customMatch_SetTeamNameCustomMatch_SetTeamName20CustomMatch_SetTeamName message.
customMatch_GetSettingsCustomMatch_GetSettings21CustomMatch_GetSettings message.

Any

Use protobuf.dev’s documentation of the Any message for more information. This documentation will relate to its use in Apex LiveAPI.

Field NameTypeTagDescription
type_urlstring1A URL that describes the type of the serialized message. LiveAPI messags use the type.googleapis.com/rtech.liveapi.<MESSAGE TYPE> format.
valuebytes2Serialized protocol buffer of the above specified type.

Response

Message used to indicate the response to a request made to the API. Only the requesting part will receive this message and this message is only sent if the request required an acknowledgement by setting withAck to true in the Request object. This message is always sent within a LiveAPIEvent and never on its own to allow any applications to have a uniform method of reading events over the wire.

Field NameTypeTagDescription
successbool1Indicates if error has occurred.
resultAny3Serialized protocol buffer of game message in an Any Message OR context of request in case of error.

LiveAPIEvent

Envelope for all LiveAPI Events. Any game events or responses to requests will be sent using this message. The specific event or message is stored in the gameMessage field.

In order to read the message successfully, check the type contained in gameMessage and create an instance of that type where you can unpack the data to Protobuf has several ways of doing type to instance lookups that will allow you to do this after you’ve generated bindings.

For example, to read and unpack any LiveAPIEvent in Python, the following can be done (assume pb_msg contains the LiveAPIEvent object):

  from events_pb2 import *
from google.protobuf import symbol_database

[ ... ]

result_type = pb_msg.gameMessage.TypeName()
msg_result = symbol_database.Default().GetSymbol(result_type)()
pb_msg.gameMessage.Unpack(msg_result) # msg_result now holds the actual event you want to read
  
Field NameTypeTagDescription
event_sizefixed321Size of protobuf event.
gameMessageAny3Serialized protocol buffer of game message in an Any Message

Last updated 14 Apr 2024, 12:21 +0700 . history