# ws.ticket.create

A pass for --user into the open room --room: signed by the platform, usable once, valid for --ttl (default 60s, at most 10m)

# ws.ticket.create

```
ws.ticket.create --room TEXT --user TEXT [--ttl DURATION] → ticket
```

A pass for `--user` into the open room `--room`: signed by the platform, usable once, valid for `--ttl` (default 60s, at most 10m). The client connects to `/ws/{owner}/{project}/rooms/{room}?ticket=…`. Issue it from a webhook that checks the app's own data first — the room queries nothing. A `--private` room admits only ticket holders. The ticket's user must be the identity the room's join rule proves; under `--auth none` it becomes the session's identity. Refused for a room that is not open (`FW_NODE_WS_ROOM_NOT_OPEN`) and for a full one. Adds `ticket: { room, ticket, expires_at }` and keeps the rest of the payload.

## Flags

- `--room` (required): The open room the ticket admits to (an exact name).
- `--user` (required): Who the ticket admits: the identity (sub) the session will have.
- `--ttl`: How long the ticket can be used (default 60s, at most 10m).

## Examples

### Let a player into a match

```
| ws.ticket.create --room "match-{{ $trigger.params.id }}" --user "{{ $trigger.auth.sub }}"
```

After `trigger.webhook --route /api/matches/:id/ticket --auth jwt` and a check that the caller belongs in match 7.

It answers:

```json
{
  "ticket": {
    "room": "match-7",
    "ticket": "eyJr…",
    "expires_at": "2026-10-16T08:01:00Z"
  }
}
```
