PubNub icon

PubNub

Interact with PubNub real-time messaging platform

Presence → Set State

AI-generated

Summary

Set presence state for one or more channels

Inputs

  • channels — Comma‑separated list of channels; leave empty for global presence.
  • uuid — User UUID to associate with the state; defaults to the authenticated user.
  • state (required) — State object to set for the user

Output shape

object representing the PubNub presence setState API response

May include success confirmation or error details; shape depends on PubNub version.

Examples

Example 1: Update presence state for multiple channels

channels: 'general,support', uuid: 'user_456', state: '{"status":"online","role":"member"}'

Example 2: Set state on a single channel

channels: 'alerts', uuid: '', state: '{"debug":true}'

Discussion