Zebflow Docs
ws.state.delete
Zebflow Docs

ws.state.delete

Removes the value at --key

ws.state.delete --key TEXT [--room TEXT] [--batch] → state

Removes the value at --key. The room's shared state is what every client of the room mirrors. --key is a JSON pointer; a part from the payload is written with {{ }}, and a segment that resolves empty is refused. --room is an exact room (a room that is not open is FW_NODE_WS_ROOM_NOT_OPEN); without it the room is the one of the trigger.room that started the run. A change past the room's --max-state is refused. Clients get a patch of only what changed at once, or with --batch on the room's 33 ms tick (in a tick room, after the tick). --visible-to <tag> (repeatable; put and update) limits the path and all under it to the sessions holding one of the tags (ws.session.tag) — fog of war, a private hand: the others are never sent it. A put without it makes the path visible to all; an update without it keeps its limit. Adds state: { key, room } and keeps the rest of the payload. Sending an event without changing state is ws.message.send.

Flags

  • --key (required): A JSON pointer into the room's state: /players/{{ input.room.session_id }}. A segment that resolves empty is refused.
  • --room: The exact room; default: the room of the trigger.room that started the run.
  • --batch: Let the room's 33 ms tick send the change, at most once a tick — for 10+ changes a second.

Examples

Remove a player who left

| ws.state.delete --key "/players/{{ input.room.session_id }}"

It answers:

json
{  "state": {    "key": "/players/s_8f2",    "room": "lobby"  }}