@quickback-dev/cli 0.10.20 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/content.d.ts.map +1 -1
- package/dist/docs/content.js +10 -5
- package/dist/docs/content.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/skill/docs/changelog.md +33 -0
- package/dist/skill/docs/stack/auth/plugins/index.md +112 -0
- package/dist/skill/docs/stack/realtime/durable-objects.md +3 -3
- package/dist/skill/docs/stack/realtime/index.md +9 -3
- package/dist/skill/docs/stack/realtime/partyserver-rooms.md +146 -0
- package/dist/skill/docs/stack/realtime/using-realtime.md +5 -5
- package/package.json +1 -1
- package/src/skill/docs/changelog.md +33 -0
- package/src/skill/docs/stack/auth/plugins/index.md +112 -0
- package/src/skill/docs/stack/realtime/durable-objects.md +3 -3
- package/src/skill/docs/stack/realtime/index.md +9 -3
- package/src/skill/docs/stack/realtime/partyserver-rooms.md +146 -0
- package/src/skill/docs/stack/realtime/using-realtime.md +5 -5
|
@@ -219,6 +219,118 @@ auth: defineAuth("better-auth", {
|
|
|
219
219
|
|
|
220
220
|
**When to enable:** you have external services (non-Quickback workers, third-party integrations) that need to verify a user's identity via JWKS without holding `BETTER_AUTH_SECRET`. The BA-issued tokens won't carry Quickback's `orgId`/`role` claims, so they're for identity, not API access.
|
|
221
221
|
|
|
222
|
+
### API Keys
|
|
223
|
+
|
|
224
|
+
Static, long-lived credentials for cron jobs, scripts, and machine-to-machine integrations. Better Auth's `apiKey` plugin is auto-included when you enable the organizations feature, so no explicit config is required for the standard B2B SaaS shape.
|
|
225
|
+
|
|
226
|
+
**Authenticating requests:**
|
|
227
|
+
|
|
228
|
+
Pass the key as the `x-api-key` header (preferred) or as an `?api_key=` / `?key=` query parameter:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Header form (preferred — keys don't leak into access logs or Referer)
|
|
232
|
+
curl -H "x-api-key: ${KEY}" https://api.example.com/v1/jobs
|
|
233
|
+
|
|
234
|
+
# Query-param form (for clients that can't inject custom headers,
|
|
235
|
+
# e.g., claude.ai's MCP connector)
|
|
236
|
+
curl "https://api.example.com/v1/jobs?api_key=${KEY}"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The header takes precedence when both are present. The query-param form lands in nginx / Cloudflare access logs and `Referer` headers when the page navigates away — prefer headers whenever the client supports them.
|
|
240
|
+
|
|
241
|
+
**Endpoints (managed by Better Auth):**
|
|
242
|
+
- `POST /auth/v1/api-key/create` — issue a new key (returns the secret once; store it)
|
|
243
|
+
- `GET /auth/v1/api-key/list` — list keys for the current user
|
|
244
|
+
- `POST /auth/v1/api-key/delete` — revoke a key
|
|
245
|
+
|
|
246
|
+
Keys can carry organization context via `metadata.organizationId` — when set, the auth middleware looks up the user's role in that org and populates `ctx.roles` accordingly, so a single key inherits the same firewall + access scope as the user who created it.
|
|
247
|
+
|
|
248
|
+
### OAuth Provider (MCP-ready)
|
|
249
|
+
|
|
250
|
+
Turns your Quickback worker into a standards-compliant OAuth 2.1 + OIDC authorization server. The plugin ships RFC 7591 dynamic client registration plus the well-known discovery documents an MCP client needs to bootstrap itself, so every future MCP client (Cursor, Claude Desktop, Cowork, custom integrations) Just Works without bespoke per-client header injection.
|
|
251
|
+
|
|
252
|
+
**Enable in config:**
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
auth: defineAuth("better-auth", {
|
|
256
|
+
plugins: ["oauthProvider"],
|
|
257
|
+
}),
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The compiler auto-includes Better Auth's `jwt` plugin alongside `oauthProvider` — `@better-auth/oauth-provider` delegates access-token signing to it, and schema generation fails without it.
|
|
261
|
+
|
|
262
|
+
**Custom configuration** (object form):
|
|
263
|
+
|
|
264
|
+
```ts
|
|
265
|
+
auth: defineAuth("better-auth", {
|
|
266
|
+
plugins: {
|
|
267
|
+
oauthProvider: {
|
|
268
|
+
consentPage: "/consent", // path on ACCOUNT_URL — default
|
|
269
|
+
loginPage: "/login", // path on ACCOUNT_URL — default
|
|
270
|
+
allowDynamicClientRegistration: true, // default
|
|
271
|
+
allowUnauthenticatedClientRegistration: true, // default — MCP needs this
|
|
272
|
+
validAudiences: ["https://api.example.com"], // optional — defaults to BETTER_AUTH_URL
|
|
273
|
+
scopes: ["openid", "profile", "email", "offline_access"],
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
}),
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Endpoints:**
|
|
280
|
+
|
|
281
|
+
Discovery (public, no auth):
|
|
282
|
+
- `GET /.well-known/oauth-authorization-server` — RFC 8414 metadata
|
|
283
|
+
- `GET /.well-known/oauth-protected-resource` — MCP resource metadata
|
|
284
|
+
- `GET /.well-known/openid-configuration` — OIDC discovery
|
|
285
|
+
|
|
286
|
+
Authorization flow:
|
|
287
|
+
- `POST /oauth2/register` — RFC 7591 dynamic client registration
|
|
288
|
+
- `POST /oauth2/authorize` — start auth code flow
|
|
289
|
+
- `POST /oauth2/token` — exchange code or refresh for access token
|
|
290
|
+
- `POST /oauth2/consent` — accept/deny (called by the consent page)
|
|
291
|
+
- `POST /oauth2/introspect` — RFC 7662 token validity check
|
|
292
|
+
- `POST /oauth2/revoke` — RFC 7009 token revocation
|
|
293
|
+
- `GET /oauth2/userinfo` — OIDC user info (requires `openid` scope)
|
|
294
|
+
|
|
295
|
+
Client management (authenticated):
|
|
296
|
+
- `GET /oauth2/get-clients`, `GET /oauth2/get-client?client_id=`, `GET /oauth2/public-client?client_id=`
|
|
297
|
+
- `POST /oauth2/create-client`, `POST /oauth2/update-client`, `POST /oauth2/delete-client`
|
|
298
|
+
- `POST /oauth2/client/rotate-secret`
|
|
299
|
+
|
|
300
|
+
Consent management:
|
|
301
|
+
- `GET /oauth2/get-consents`, `GET /oauth2/get-consent?id=`
|
|
302
|
+
- `POST /oauth2/update-consent`, `POST /oauth2/delete-consent`
|
|
303
|
+
|
|
304
|
+
**Account SPA wiring:**
|
|
305
|
+
|
|
306
|
+
The compiled Account SPA already serves `/consent`. When `oauthProvider` is enabled, Better Auth redirects unauthenticated users to `${ACCOUNT_URL}/login?redirect=...` and authenticated users straight to `${ACCOUNT_URL}/consent?client_id=...&scope=...&oauth_query=...`. The bundled consent screen reads those params, fetches client metadata via `/oauth2/public-client`, and POSTs back to `/oauth2/consent`.
|
|
307
|
+
|
|
308
|
+
**Verifying tokens in your own Workers / route handlers:**
|
|
309
|
+
|
|
310
|
+
Issued tokens are JWTs by default — verify them locally without a DB hit:
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
import { createAuthClient } from "better-auth/client";
|
|
314
|
+
import { oauthProviderResourceClient } from "@better-auth/oauth-provider/resource-client";
|
|
315
|
+
import { auth } from "./auth";
|
|
316
|
+
|
|
317
|
+
const serverClient = createAuthClient({
|
|
318
|
+
plugins: [oauthProviderResourceClient(auth)],
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
const token = req.headers.get("authorization")?.replace("Bearer ", "");
|
|
322
|
+
const payload = await serverClient.verifyAccessToken(token, {
|
|
323
|
+
verifyOptions: { issuer: env.BETTER_AUTH_URL, audience: env.BETTER_AUTH_URL },
|
|
324
|
+
});
|
|
325
|
+
// payload.sub → userId, payload.scope → granted scopes
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Why this and not the deprecated `mcp` plugin?**
|
|
329
|
+
|
|
330
|
+
Better Auth's older `better-auth/plugins/mcp` is being deprecated in favour of `@better-auth/oauth-provider`. The new package is a full OAuth 2.1 server (the MCP plugin only exposed a subset), supports dynamic registration that MCP clients now require, and lets you scope/revoke per-client.
|
|
331
|
+
|
|
332
|
+
Keep `apiKey` enabled alongside it — server-to-server flows (cron, scripts) want a static key; OAuth is for interactive clients.
|
|
333
|
+
|
|
222
334
|
## Where This Runs
|
|
223
335
|
|
|
224
336
|
All Better Auth plugin routes are served under your auth base path:
|
|
@@ -244,7 +244,7 @@ Quickback uses **ticket-based authentication** for WebSocket connections. The cl
|
|
|
244
244
|
|
|
245
245
|
```typescript
|
|
246
246
|
// 1. Get a ws-ticket from your API (requires session auth)
|
|
247
|
-
const response = await fetch('/
|
|
247
|
+
const response = await fetch('/broadcast/v1/ws-ticket', {
|
|
248
248
|
method: 'POST',
|
|
249
249
|
headers: { Authorization: `Bearer ${sessionToken}` },
|
|
250
250
|
});
|
|
@@ -252,7 +252,7 @@ const { wsTicket } = await response.json();
|
|
|
252
252
|
|
|
253
253
|
// 2. Connect with ticket as URL param
|
|
254
254
|
const ws = new WebSocket(
|
|
255
|
-
`wss://api.yourdomain.com/
|
|
255
|
+
`wss://api.yourdomain.com/broadcast/v1/websocket?ws_ticket=${wsTicket}&organizationId=${activeOrgId}`
|
|
256
256
|
);
|
|
257
257
|
|
|
258
258
|
ws.onopen = () => {
|
|
@@ -331,7 +331,7 @@ new_classes = ["Broadcaster"]
|
|
|
331
331
|
WebSocket (verified at upgrade)
|
|
332
332
|
```
|
|
333
333
|
|
|
334
|
-
1. **Client gets a ticket** — `POST /
|
|
334
|
+
1. **Client gets a ticket** — `POST /broadcast/v1/ws-ticket` on the main API (session-authenticated). Returns a 60-second HMAC-signed ticket.
|
|
335
335
|
2. **Client connects** — Opens WebSocket with `?ws_ticket=<ticket>`. The Durable Object verifies the ticket cryptographically at upgrade — no HTTP round-trip.
|
|
336
336
|
3. **API broadcasts** — After CRUD ops, the API calls the Broadcaster DO directly via its binding (in-process, no network hop).
|
|
337
337
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Realtime
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Quickback ships **two parallel realtime primitives**, both backed by Cloudflare Durable Objects:
|
|
4
|
+
|
|
5
|
+
- **`/broadcast/v1/*` — server fan-out.** One DO instance per organization. Postgres-changes events from CRUD routes plus custom broadcast events flow out to every subscriber, with role filtering and per-role field masking applied. Best for "tell every client in this org that something changed." Documented on this page.
|
|
6
|
+
- **`/realtime/<binding>/<room-id>` — bidirectional rooms.** One DO instance per room (per document, per interview, per game). Client↔client messages, presence, and CRDT-friendly state. Use these for collaborative editing. See [PartyServer rooms](/stack/realtime/partyserver-rooms).
|
|
7
|
+
|
|
8
|
+
Both share the same auth model and ride on the same compiled worker; they solve different problems.
|
|
4
9
|
|
|
5
10
|
## Architecture
|
|
6
11
|
|
|
@@ -63,5 +68,6 @@ And enable the realtime binding in your database config. The compiler generates
|
|
|
63
68
|
|
|
64
69
|
## Pages
|
|
65
70
|
|
|
66
|
-
- **[Durable Objects Setup](/stack/realtime/durable-objects)** —
|
|
67
|
-
- **[Using Realtime](/stack/realtime/using-realtime)** — WebSocket connection,
|
|
71
|
+
- **[Durable Objects Setup](/stack/realtime/durable-objects)** — Broadcaster configuration, wrangler bindings, event formats, masking, and custom namespaces
|
|
72
|
+
- **[Using Realtime](/stack/realtime/using-realtime)** — Subscribing to `/broadcast/v1/*`: WebSocket connection, ticket auth, client-side handling
|
|
73
|
+
- **[PartyServer Rooms](/stack/realtime/partyserver-rooms)** — Per-room collab via `/realtime/<binding>/<room-id>`: presence, live notes, room IDs
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# PartyServer Rooms
|
|
2
|
+
|
|
3
|
+
When you need **client↔client** state — presence, live cursors, shared notes, concurrent editing — Quickback exposes [PartyServer](https://github.com/cloudflare/partykit) rooms at `/realtime/<binding>/<room-id>`. Each room is its own Durable Object instance, so isolation between rooms is automatic and the runtime hibernates idle rooms for free.
|
|
4
|
+
|
|
5
|
+
This is **separate from `/broadcast/v1/*`** (the org-wide server fan-out documented in [Using Realtime](/stack/realtime/using-realtime)). They share the worker and the auth model but solve different problems:
|
|
6
|
+
|
|
7
|
+
| Concern | `/broadcast/v1/*` | `/realtime/<binding>/<room-id>` |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| Direction | Server → clients | Client ↔ clients |
|
|
10
|
+
| Sharding | One DO per org | One DO per room |
|
|
11
|
+
| Use case | Postgres-changes, app-wide events | Live cursors, shared edits, presence |
|
|
12
|
+
| Catchup | Ephemeral | Per-room state survives reconnects |
|
|
13
|
+
|
|
14
|
+
## When to use rooms vs broadcast
|
|
15
|
+
|
|
16
|
+
Reach for rooms when **the messages flow between users in the same context** (interview, document, game match). Reach for broadcast when **the server is publishing facts** that any client in the org may want to react to (a record was updated, a webhook fired, a role changed).
|
|
17
|
+
|
|
18
|
+
You can use both in the same project. Cost is the same.
|
|
19
|
+
|
|
20
|
+
## Define a room class
|
|
21
|
+
|
|
22
|
+
The PartyServer `Server` class extends `DurableObject`, so any in-worker DO you wire up via `bindings.durableObjects` qualifies. The lifecycle hooks below are what PartyServer adds on top:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
// quickback/features/interviews/lib/InterviewRoom.ts
|
|
26
|
+
import { Server, type Connection, type WSMessage } from 'partyserver';
|
|
27
|
+
|
|
28
|
+
export class InterviewRoom extends Server {
|
|
29
|
+
static options = { hibernate: true };
|
|
30
|
+
|
|
31
|
+
presence = new Map<string, { userId?: string; name?: string }>();
|
|
32
|
+
|
|
33
|
+
onConnect(connection: Connection) {
|
|
34
|
+
this.presence.set(connection.id, {});
|
|
35
|
+
this.broadcastPresence();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onMessage(connection: Connection, message: WSMessage) {
|
|
39
|
+
if (typeof message !== 'string') return;
|
|
40
|
+
const parsed = JSON.parse(message);
|
|
41
|
+
if (parsed.type === 'note') {
|
|
42
|
+
this.broadcast(JSON.stringify({ type: 'note', from: connection.id, body: parsed.body }), [connection.id]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
onClose(connection: Connection) {
|
|
47
|
+
this.presence.delete(connection.id);
|
|
48
|
+
this.broadcastPresence();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private broadcastPresence() {
|
|
52
|
+
const peers = Array.from(this.presence.entries()).map(([id, meta]) => ({ id, ...meta }));
|
|
53
|
+
this.broadcast(JSON.stringify({ type: 'presence', peers }));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Wire it into your config
|
|
59
|
+
|
|
60
|
+
One entry under `bindings.durableObjects` is everything the compiler needs. The Server class lives under a `lib/` directory inside the feature (the same path the compiler uses for any in-worker shared code) — author it at `quickback/features/interviews/lib/InterviewRoom.ts`. The `from` value is the corresponding module path, no extension.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// quickback/quickback.config.ts
|
|
64
|
+
export default defineConfig({
|
|
65
|
+
// ...
|
|
66
|
+
bindings: {
|
|
67
|
+
durableObjects: [
|
|
68
|
+
{
|
|
69
|
+
name: 'INTERVIEW_ROOM',
|
|
70
|
+
className: 'InterviewRoom',
|
|
71
|
+
from: 'features/interviews/lib/InterviewRoom',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
build: {
|
|
76
|
+
dependencies: {
|
|
77
|
+
partyserver: '^0.5.5',
|
|
78
|
+
partysocket: '^1.1.18',
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The compiler emits the `[[durable_objects.bindings]]` block, the `[[migrations]]` entry (SQLite-backed by default), and the class re-export from `src/index.ts`. **It also auto-mounts the `hono-party` middleware at `/realtime/*`** the moment any in-worker DO is declared, so URL routing follows PartyServer's own convention.
|
|
85
|
+
|
|
86
|
+
## Connect from the client
|
|
87
|
+
|
|
88
|
+
The `partysocket` package handles reconnection, buffering, and resilience. The `party` field is the kebab-cased binding name (`INTERVIEW_ROOM` → `interview-room`); the `room` field is any opaque ID.
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import PartySocket from 'partysocket';
|
|
92
|
+
|
|
93
|
+
const socket = new PartySocket({
|
|
94
|
+
host: window.location.host,
|
|
95
|
+
party: 'interview-room',
|
|
96
|
+
room: 'interview-abc123',
|
|
97
|
+
prefix: 'realtime',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
socket.addEventListener('message', (e) => {
|
|
101
|
+
const msg = JSON.parse(e.data);
|
|
102
|
+
if (msg.type === 'presence') updatePresence(msg.peers);
|
|
103
|
+
if (msg.type === 'note') appendNote(msg.from, msg.body);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
socket.send(JSON.stringify({ type: 'note', body: 'asked about tenure' }));
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Authentication
|
|
110
|
+
|
|
111
|
+
PartyServer accepts an `onBeforeConnect` hook that runs before the WebSocket upgrade. Reject the upgrade by returning a `Response`; otherwise return `undefined` (or a modified `Request`) and the connection proceeds. This is where you call into Quickback's existing auth path:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
import { partyserverMiddleware } from 'hono-party';
|
|
115
|
+
|
|
116
|
+
app.use('/realtime/*', partyserverMiddleware({
|
|
117
|
+
options: {
|
|
118
|
+
prefix: 'realtime',
|
|
119
|
+
onBeforeConnect: async (req) => {
|
|
120
|
+
const token = new URL(req.url).searchParams.get('ws_ticket');
|
|
121
|
+
if (!token || !await verifyTicket(token)) {
|
|
122
|
+
return new Response('Unauthorized', { status: 401 });
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}));
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
For the auto-mounted middleware (the default), the same `ws_ticket` flow used by `/broadcast/v1/*` works — generate a ticket from your authenticated UI and pass it as a query param.
|
|
130
|
+
|
|
131
|
+
## CRDT-grade document collab (Yjs)
|
|
132
|
+
|
|
133
|
+
Drop in [`Y-PartyServer`](https://github.com/cloudflare/partykit) when you need true concurrent text/document editing. It's a `Server` subclass that wraps Yjs's sync protocol; everything else above stays the same.
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import { YServer } from 'y-partyserver';
|
|
137
|
+
|
|
138
|
+
export class DocumentRoom extends YServer {
|
|
139
|
+
// Yjs doc lives on `this.doc`; sync protocol is automatic.
|
|
140
|
+
// Override `onLoad()` / `onSave()` to persist to R2 / KV / your DB.
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Why this and not the Broadcaster
|
|
145
|
+
|
|
146
|
+
The Broadcaster is a one-DO-per-org fan-out. It can't shard by document, and it doesn't model client→client messages. PartyServer's per-room model is the right primitive for collab; the Broadcaster's per-org model is the right primitive for "tell everyone in this org that X happened." Run both.
|
|
@@ -7,7 +7,7 @@ This page covers connecting to the Quickback realtime system from client applica
|
|
|
7
7
|
Open a WebSocket connection to the realtime worker:
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
|
-
const ws = new WebSocket("wss://api.yourdomain.com/
|
|
10
|
+
const ws = new WebSocket("wss://api.yourdomain.com/broadcast/v1/websocket");
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Authentication
|
|
@@ -22,7 +22,7 @@ This approach is faster and more secure than in-band auth messages — the conne
|
|
|
22
22
|
### Step 1: Get a WebSocket Ticket
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
|
-
const response = await fetch("/
|
|
25
|
+
const response = await fetch("/broadcast/v1/ws-ticket", {
|
|
26
26
|
method: "POST",
|
|
27
27
|
headers: {
|
|
28
28
|
Authorization: `Bearer ${sessionToken}`,
|
|
@@ -39,7 +39,7 @@ The ticket is a short-lived (60-second) HMAC-signed token containing your userId
|
|
|
39
39
|
|
|
40
40
|
```typescript
|
|
41
41
|
const ws = new WebSocket(
|
|
42
|
-
`wss://api.yourdomain.com/
|
|
42
|
+
`wss://api.yourdomain.com/broadcast/v1/websocket?ws_ticket=${wsTicket}&organizationId=${activeOrgId}`
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
ws.onopen = () => {
|
|
@@ -161,14 +161,14 @@ WebSocket connections can drop due to network issues. Implement reconnection log
|
|
|
161
161
|
```typescript
|
|
162
162
|
async function connect() {
|
|
163
163
|
// Get a fresh ticket each time
|
|
164
|
-
const res = await fetch("/
|
|
164
|
+
const res = await fetch("/broadcast/v1/ws-ticket", {
|
|
165
165
|
method: "POST",
|
|
166
166
|
headers: { Authorization: `Bearer ${sessionToken}` },
|
|
167
167
|
});
|
|
168
168
|
const { wsTicket } = await res.json();
|
|
169
169
|
|
|
170
170
|
const ws = new WebSocket(
|
|
171
|
-
`wss://api.yourdomain.com/
|
|
171
|
+
`wss://api.yourdomain.com/broadcast/v1/websocket?ws_ticket=${wsTicket}&organizationId=${activeOrgId}`
|
|
172
172
|
);
|
|
173
173
|
|
|
174
174
|
ws.onclose = () => {
|