Skip to main content

Social

Social gives a Cauldron deck the signed-in player's mutual Castle follows. The host supplies the player and current deck from trusted play context; a deck cannot ask about another account or deck. A host from before Social rejects with CastleError code UNKNOWN_COMMAND.

  • Social.friends() returns at most 20 mutual follows as { userId, username, photoUrl? }. A one-way follow is not a friend here.
  • Social.presence() returns the mutual friends playing this deck now as { userId, username, photoUrl?, sessionId, updatedAt }. Castle's now-playing privacy and multiplayer gates apply. It fails closed to [] when presence is gated or unavailable.

Presence has no event in v1. Poll Social.presence() when the game needs to refresh its list; do not treat updatedAt as a durable offline record.

import { Social } from "castle-web-sdk";

const friends = await Social.friends();
const playingHere = await Social.presence();