Skip to content

Commit

Permalink
docs: updated io.createToken docs to include the platform context (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
pluvrt authored Mar 3, 2024
1 parent a8ddd9d commit ddf025b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/web/src/inputs/docs/@pluv_io/API Reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ Creates a JWT for a user trying to connect to a room. This should be called with

```ts
const token = await io.createToken({
// If using @platform/node
req: req as IncomingMessage,
// If using @platform/cloudflare
// This is the env from the Cloudflare worker handler's fetch function
env: env as Env,
// ...
room: "my-example-room",
user: {
id: "abc123",
Expand Down Expand Up @@ -167,4 +173,5 @@ Registers a websocket to the room. Accepts a secondary options parameter to pass
room.register(webSocket, { token })
```

export default ({ children }) => <DocsLayout meta={meta}>{children}</DocsLayout>;
export default ({ children }) => <DocsLayout meta={meta}>{children}</DocsLayout>;import { IncomingMessage } from "http";

0 comments on commit ddf025b

Please sign in to comment.