Zebflow Docs
ws.session.close
Zebflow Docs

ws.session.close

Closes the session --session (its id), or every session of the identity --user (its sub), in the room --room — an exact name, or a pattern reaching every open room it matches; without --room, the room of the trigger.room that started the run

ws.session.close [--room TEXT] [--session TEXT] [--user TEXT] → session

Closes the session --session (its id), or every session of the identity --user (its sub), in the room --room — an exact name, or a pattern reaching every open room it matches; without --room, the room of the trigger.room that started the run. Each is closed with 4409 and raises $disconnect { reason: "closed" }. Give one of --session and --user. Kicking someone is a webhook the app guards with its own auth, ending here — never an event a client sends. An exact room that is not open is FW_NODE_WS_ROOM_NOT_OPEN. Adds session: { room, closed } (how many were closed) and keeps the rest of the payload.

Flags

  • --room: The room — an exact name or a pattern; default: the room of the trigger.room that started the run.
  • --session: The session to close (its id, input.room.session_id where it joined).
  • --user: Close every session of this identity (its sub).

Examples

Ban a player from every zone

| ws.session.close --room "zone-*" --user "{{ $trigger.body.player }}"

After trigger.webhook --route /api/ban --method POST --auth jwt --credential admin-key --role moderator.

It answers:

json
{  "session": {    "room": "zone-*",    "closed": 2  }}