C++ SDK — Room Actions

Room Actions

submitAction
template<typename T = nlohmann::json>
static ActionSubmitResponse submitAction(
    Client& client,
    const std::string& playerToken,
    const SubmitAction<T>& request
)

Submits a game action to specific targets (host, all, others, or specific players) with typed request data.

pollActions
template<typename T = nlohmann::json>
static ActionPollResponse<T> pollActions(
    Client& client,
    const std::string& playerToken
)

Polls for completed actions from other players with typed response data.

getPendingActions
template<typename T = nlohmann::json>
static ActionPendingResponse<T> getPendingActions(
    Client& client,
    const std::string& playerToken
)

Retrieves a list of pending actions that need to be processed with typed request data.

completeAction
template<typename T = nlohmann::json>
static ActionCompleteResponse completeAction(
    Client& client,
    const std::string& actionId,
    const std::string& playerToken,
    const ActionComplete<T>& request
)

Marks an action as completed with response data using typed ActionComplete parameter.

Request/response actions

Actions are the room's request/response primitive — trades, votes, dialogs, ability prompts. Send issues a typed action at a target set: everyone, the host, everyone-but-you, or an explicit list of player ids. Each action carries a request payload and waits for an answer rather than firing and forgetting.

Recipients poll for actions addressed to them and answer with complete — a status marking it accepted, declined or completed, plus an optional response payload. Pending lists the sender's own still-unanswered actions, so a reconnecting client can rebuild its outstanding-request view.

  • The action type string is game-defined — version it like a protocol field as your game evolves.
  • Actions persist until answered: poll after rejoining so missed requests still get a response.
  • Need fire-and-forget state instead? Use room updates for durable state and realtime for ephemeral events.
  • Calls are synchronous functions that take the client by reference — keep them off the frame-critical path in games that cannot stall, and use the typed template overloads to deserialize player data into your own structs.