[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-rivet-rivetkit-client-swift":3,"mdc--ju0dq2-key":38,"related-org-rivet-rivetkit-client-swift":3259,"related-repo-rivet-rivetkit-client-swift":3465},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":27,"repoUrl":28,"updatedAt":29,"license":30,"forks":31,"topics":32,"repo":33,"sourceUrl":36,"mdContent":37},"rivetkit-client-swift","use RivetKit Swift client","RivetKit Swift client guidance. Use for Swift clients that connect to Rivet Actors with RivetKitClient, create actor handles, call actions, or manage connections.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"rivet","Rivet","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Frivet.png","rivet-dev",[13,15,18,21,24],{"name":9,"slug":8,"type":14},"tag",{"name":16,"slug":17,"type":14},"iOS","ios",{"name":19,"slug":20,"type":14},"Mobile","mobile",{"name":22,"slug":23,"type":14},"Swift","swift",{"name":25,"slug":26,"type":14},"SDK","sdk",17,"https:\u002F\u002Fgithub.com\u002Frivet-dev\u002Fskills","2026-07-24T05:38:59.105683",null,7,[],{"repoUrl":28,"stars":27,"forks":31,"topics":34,"description":35},[],"Generated skill files for Rivet AI integrations","https:\u002F\u002Fgithub.com\u002Frivet-dev\u002Fskills\u002Ftree\u002FHEAD\u002Frivetkit-client-swift","---\nname: \"rivetkit-client-swift\"\ndescription: \"RivetKit Swift client guidance. Use for Swift clients that connect to Rivet Actors with RivetKitClient, create actor handles, call actions, or manage connections.\"\n---\n\n# RivetKit Swift Client\n\nUse this skill when building Swift clients that connect to Rivet Actors with `RivetKitClient`.\n\n## Version\n\nRivetKit version: 2.3.7\n\n## Error Handling Policy\n\n- Prefer fail-fast behavior by default.\n- Avoid broad `do\u002Fcatch` unless absolutely needed.\n- If a catch block is used, handle the error explicitly, at minimum by logging it.\n\n## Install\n\nAdd the Swift package dependency and import `RivetKitClient`:\n\n```swift\n\u002F\u002F Package.swift\ndependencies: [\n    .package(url: \"https:\u002F\u002Fgithub.com\u002Frivet-dev\u002Frivetkit-swift\", from: \"2.0.0\")\n]\n\ntargets: [\n    .target(\n        name: \"MyApp\",\n        dependencies: [\n            .product(name: \"RivetKitClient\", package: \"rivetkit-swift\")\n        ]\n    )\n]\n```\n\n## Minimal Client\n\n### Endpoint URL\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(\n    endpoint: \"https:\u002F\u002Fmy-namespace:pk_...@api.rivet.dev\"\n)\nlet client = RivetKitClient(config: config)\n\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\nlet count: Int = try await handle.action(\"increment\", 1, as: Int.self)\n```\n\n### Explicit Fields\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(\n    endpoint: \"https:\u002F\u002Fapi.rivet.dev\",\n    namespace: \"my-namespace\",\n    token: \"pk_...\"\n)\nlet client = RivetKitClient(config: config)\n\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\nlet count: Int = try await handle.action(\"increment\", 1, as: Int.self)\n```\n\n## Stateless vs Stateful\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\n\n\u002F\u002F Stateless: each call is independent\nlet current: Int = try await handle.action(\"getCount\", as: Int.self)\nprint(\"Current count: \\(current)\")\n\n\u002F\u002F Stateful: keep a connection open for realtime events\nlet conn = handle.connect()\n\n\u002F\u002F Subscribe to events using AsyncStream\nlet eventTask = Task {\n    for await count in await conn.events(\"count\", as: Int.self) {\n        print(\"Event: \\(count)\")\n    }\n}\n\n_ = try await conn.action(\"increment\", 1, as: Int.self)\n\neventTask.cancel()\nawait conn.dispose()\nawait client.dispose()\n```\n\n## Getting Actors\n\n```swift\nimport RivetKitClient\n\nstruct GameInput: Encodable {\n    let mode: String\n}\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\n\u002F\u002F Get or create an actor\nlet room = client.getOrCreate(\"chatRoom\", [\"room-42\"])\n\n\u002F\u002F Get an existing actor (fails if not found)\nlet existing = client.get(\"chatRoom\", [\"room-42\"])\n\n\u002F\u002F Create a new actor with input\nlet created = try await client.create(\n    \"game\",\n    [\"game-1\"],\n    options: CreateOptions(input: GameInput(mode: \"ranked\"))\n)\n\n\u002F\u002F Get actor by ID\nlet byId = client.getForId(\"chatRoom\", \"actor-id\")\n\n\u002F\u002F Resolve actor ID\nlet resolvedId = try await room.resolve()\nprint(\"Resolved ID: \\(resolvedId)\")\n\nawait client.dispose()\n```\n\nActions support positional overloads for 0–5 args:\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\n\nlet count: Int = try await handle.action(\"getCount\")\nlet updated: String = try await handle.action(\"rename\", \"new-name\")\nlet ok: Bool = try await handle.action(\"setScore\", \"user-1\", 42)\n\nprint(\"Count: \\(count), Updated: \\(updated), OK: \\(ok)\")\nawait client.dispose()\n```\n\nIf you need more than 5 arguments, use the raw JSON fallback:\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\n\nlet args: [JSONValue] = [\n    .string(\"user-1\"),\n    .number(.int(42)),\n    .string(\"extra\"),\n    .string(\"more\"),\n    .string(\"args\"),\n    .string(\"here\")\n]\nlet ok: Bool = try await handle.action(\"setScore\", args: args, as: Bool.self)\nprint(\"OK: \\(ok)\")\n\nawait client.dispose()\n```\n\n## Connection Parameters\n\n```swift\nimport RivetKitClient\n\nstruct ConnParams: Encodable {\n    let authToken: String\n}\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\nlet chat = client.getOrCreate(\n    \"chatRoom\",\n    [\"general\"],\n    options: GetOrCreateOptions(params: ConnParams(authToken: \"jwt-token-here\"))\n)\n\nlet conn = chat.connect()\n\n\u002F\u002F Use the connection...\nfor await status in await conn.statusChanges() {\n    print(\"Status: \\(status.rawValue)\")\n    if status == .connected {\n        break\n    }\n}\n\nawait conn.dispose()\nawait client.dispose()\n```\n\n## Subscribing to Events\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet conn = client.getOrCreate(\"chatRoom\", [\"general\"]).connect()\n\n\u002F\u002F Subscribe to events using AsyncStream\nlet messageTask = Task {\n    for await (from, body) in await conn.events(\"message\", as: (String, String).self) {\n        print(\"\\(from): \\(body)\")\n    }\n}\n\n\u002F\u002F For one-time events, break after receiving\nlet gameOverTask = Task {\n    for await _ in await conn.events(\"gameOver\", as: Void.self) {\n        print(\"done\")\n        break\n    }\n}\n\n\u002F\u002F Let it run for a bit\ntry await Task.sleep(for: .seconds(5))\n\n\u002F\u002F Cancel when done\nmessageTask.cancel()\ngameOverTask.cancel()\nawait conn.dispose()\nawait client.dispose()\n```\n\nEvent streams support 0–5 typed arguments. If you need raw values or more than 5 arguments, use `JSONValue`:\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet conn = client.getOrCreate(\"chatRoom\", [\"general\"]).connect()\n\nlet rawTask = Task {\n    for await args in await conn.events(\"message\") {\n        print(args)\n    }\n}\n\ntry await Task.sleep(for: .seconds(5))\nrawTask.cancel()\nawait conn.dispose()\nawait client.dispose()\n```\n\n## Connection Lifecycle\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet conn = client.getOrCreate(\"chatRoom\", [\"general\"]).connect()\n\n\u002F\u002F Monitor status changes (immediately yields current status)\nlet statusTask = Task {\n    for await status in await conn.statusChanges() {\n        print(\"status: \\(status.rawValue)\")\n    }\n}\n\n\u002F\u002F Monitor errors\nlet errorTask = Task {\n    for await error in await conn.errors() {\n        print(\"error: \\(error.group).\\(error.code)\")\n    }\n}\n\n\u002F\u002F Monitor open\u002Fclose events\nlet openTask = Task {\n    for await _ in await conn.opens() {\n        print(\"connected\")\n    }\n}\n\nlet closeTask = Task {\n    for await _ in await conn.closes() {\n        print(\"disconnected\")\n    }\n}\n\n\u002F\u002F Check current status\nlet current = await conn.currentStatus\nprint(\"Current status: \\(current.rawValue)\")\n\n\u002F\u002F Let it run for a bit\ntry await Task.sleep(for: .seconds(5))\n\n\u002F\u002F Cleanup\nstatusTask.cancel()\nerrorTask.cancel()\nopenTask.cancel()\ncloseTask.cancel()\nawait conn.dispose()\nawait client.dispose()\n```\n\n## Low-Level HTTP & WebSocket\n\nFor actors that implement `onRequest` or `onWebSocket`, you can call them directly:\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet handle = client.getOrCreate(\"chatRoom\", [\"general\"])\n\n\u002F\u002F Raw HTTP request\nlet response = try await handle.fetch(\"history\")\nlet history: [String] = try response.json([String].self)\nprint(\"History: \\(history)\")\n\n\u002F\u002F Raw WebSocket connection\nlet websocket = try await handle.websocket(path: \"stream\")\ntry await websocket.send(text: \"hello\")\nlet message = try await websocket.receive()\nprint(\"Received: \\(message)\")\n\nawait client.dispose()\n```\n\n## Calling from Backend\n\nUse the same client in server-side Swift (Vapor, Hummingbird, etc.):\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\nlet handle = client.getOrCreate(\"counter\", [\"server-counter\"])\nlet count: Int = try await handle.action(\"increment\", 1, as: Int.self)\nprint(\"Count: \\(count)\")\n\nawait client.dispose()\n```\n\n## Error Handling\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\ndo {\n    _ = try await client.getOrCreate(\"user\", [\"user-123\"])\n        .action(\"updateUsername\", \"ab\", as: String.self)\n} catch let error as ActorError {\n    print(\"Error code: \\(error.code)\")\n    print(\"Metadata: \\(String(describing: error.metadata))\")\n}\n\nawait client.dispose()\n```\n\nIf you need an untyped response, you can decode to `JSONValue`:\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet handle = client.getOrCreate(\"data\", [\"raw\"])\n\nlet value: JSONValue = try await handle.action(\"getRawPayload\")\nprint(\"Raw value: \\(value)\")\n\nawait client.dispose()\n```\n\n## Concepts\n\n### Keys\n\nKeys uniquely identify actor instances. Use compound keys (arrays) for hierarchical addressing:\n\n```swift\nimport RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\n\u002F\u002F Use compound keys for hierarchical addressing\nlet room = client.getOrCreate(\"chatRoom\", [\"org-acme\", \"general\"])\nlet actorId = try await room.resolve()\nprint(\"Actor ID: \\(actorId)\")\n\nawait client.dispose()\n```\n\nDon't build keys with string interpolation like `\"org:\\(userId)\"` when `userId` contains user data. Use arrays instead to prevent key injection attacks.\n\n### Environment Variables\n\n`ClientConfig` reads optional values from environment variables:\n\n- `RIVET_NAMESPACE` - Namespace (can also be in endpoint URL)\n- `RIVET_TOKEN` - Authentication token (can also be in endpoint URL)\n- `RIVET_RUNNER` - Runner name (defaults to `\"default\"`)\n\nThe `endpoint` parameter is always required. There is no default endpoint.\n\n### Endpoint Format\n\nEndpoints support URL auth syntax:\n\n```\nhttps:\u002F\u002Fnamespace:token@api.rivet.dev\n```\n\nYou can also pass the endpoint without auth and provide `RIVET_NAMESPACE` and `RIVET_TOKEN` separately. For serverless deployments, set the endpoint to your app's `\u002Fapi\u002Frivet` URL. See [Endpoints](\u002Fdocs\u002Fgeneral\u002Fendpoints#url-auth-syntax) for details.\n\n## API Reference\n\n### Client\n- `RivetKitClient(config:)` - Create a client with a config\n- `ClientConfig` - Configure endpoint, namespace, and token\n- `client.get()` \u002F `getOrCreate()` \u002F `getForId()` \u002F `create()` - Get actor handles\n- `client.dispose()` - Dispose the client and all connections\n\n### ActorHandle\n- `handle.action(name, args..., as:)` - Stateless action call\n- `handle.connect()` - Create a stateful connection\n- `handle.resolve()` - Get the actor ID\n- `handle.getGatewayUrl()` - Get the raw gateway URL\n- `handle.fetch(path, request:)` - Raw HTTP request\n- `handle.websocket(path:)` - Raw WebSocket connection\n\n### ActorConnection\n- `conn.action(name, args..., as:)` - Action call over WebSocket\n- `conn.events(name, as:)` - AsyncStream of typed events\n- `conn.statusChanges()` - AsyncStream of status changes\n- `conn.errors()` - AsyncStream of connection errors\n- `conn.opens()` - AsyncStream that yields on connection open\n- `conn.closes()` - AsyncStream that yields on connection close\n- `conn.currentStatus` - Current connection status\n- `conn.dispose()` - Close the connection\n\n### Types\n- `ActorConnStatus` - Connection status enum (`.idle`, `.connecting`, `.connected`, `.disconnected`, `.disposed`)\n- `ActorError` - Typed actor errors with `group`, `code`, `message`, `metadata`\n- `JSONValue` - Raw JSON value for untyped responses\n\n## Need More Than the Client?\n\nIf you need more about Rivet Actors, registries, or server-side RivetKit, add the main skill:\n\n```bash\nnpx skills add rivet-dev\u002Fskills\n```\n\nThen use the `rivetkit` skill for backend guidance.\n\n",{"data":39,"body":40},{"name":4,"description":6},{"type":41,"children":42},"root",[43,52,67,74,79,85,113,119,131,259,265,272,349,355,442,448,665,671,908,913,1008,1013,1155,1161,1369,1375,1598,1610,1733,1739,2115,2121,2142,2285,2291,2296,2375,2381,2492,2503,2583,2589,2595,2600,2688,2709,2715,2726,2770,2783,2789,2794,2804,2840,2846,2852,2920,2926,2995,3001,3092,3098,3195,3201,3206,3240,3253],{"type":44,"tag":45,"props":46,"children":48},"element","h1",{"id":47},"rivetkit-swift-client",[49],{"type":50,"value":51},"text","RivetKit Swift Client",{"type":44,"tag":53,"props":54,"children":55},"p",{},[56,58,65],{"type":50,"value":57},"Use this skill when building Swift clients that connect to Rivet Actors with ",{"type":44,"tag":59,"props":60,"children":62},"code",{"className":61},[],[63],{"type":50,"value":64},"RivetKitClient",{"type":50,"value":66},".",{"type":44,"tag":68,"props":69,"children":71},"h2",{"id":70},"version",[72],{"type":50,"value":73},"Version",{"type":44,"tag":53,"props":75,"children":76},{},[77],{"type":50,"value":78},"RivetKit version: 2.3.7",{"type":44,"tag":68,"props":80,"children":82},{"id":81},"error-handling-policy",[83],{"type":50,"value":84},"Error Handling Policy",{"type":44,"tag":86,"props":87,"children":88},"ul",{},[89,95,108],{"type":44,"tag":90,"props":91,"children":92},"li",{},[93],{"type":50,"value":94},"Prefer fail-fast behavior by default.",{"type":44,"tag":90,"props":96,"children":97},{},[98,100,106],{"type":50,"value":99},"Avoid broad ",{"type":44,"tag":59,"props":101,"children":103},{"className":102},[],[104],{"type":50,"value":105},"do\u002Fcatch",{"type":50,"value":107}," unless absolutely needed.",{"type":44,"tag":90,"props":109,"children":110},{},[111],{"type":50,"value":112},"If a catch block is used, handle the error explicitly, at minimum by logging it.",{"type":44,"tag":68,"props":114,"children":116},{"id":115},"install",[117],{"type":50,"value":118},"Install",{"type":44,"tag":53,"props":120,"children":121},{},[122,124,129],{"type":50,"value":123},"Add the Swift package dependency and import ",{"type":44,"tag":59,"props":125,"children":127},{"className":126},[],[128],{"type":50,"value":64},{"type":50,"value":130},":",{"type":44,"tag":132,"props":133,"children":137},"pre",{"className":134,"code":135,"language":23,"meta":136,"style":136},"language-swift shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Package.swift\ndependencies: [\n    .package(url: \"https:\u002F\u002Fgithub.com\u002Frivet-dev\u002Frivetkit-swift\", from: \"2.0.0\")\n]\n\ntargets: [\n    .target(\n        name: \"MyApp\",\n        dependencies: [\n            .product(name: \"RivetKitClient\", package: \"rivetkit-swift\")\n        ]\n    )\n]\n","",[138],{"type":44,"tag":59,"props":139,"children":140},{"__ignoreMap":136},[141,152,161,170,179,189,198,206,215,224,233,242,251],{"type":44,"tag":142,"props":143,"children":146},"span",{"class":144,"line":145},"line",1,[147],{"type":44,"tag":142,"props":148,"children":149},{},[150],{"type":50,"value":151},"\u002F\u002F Package.swift\n",{"type":44,"tag":142,"props":153,"children":155},{"class":144,"line":154},2,[156],{"type":44,"tag":142,"props":157,"children":158},{},[159],{"type":50,"value":160},"dependencies: [\n",{"type":44,"tag":142,"props":162,"children":164},{"class":144,"line":163},3,[165],{"type":44,"tag":142,"props":166,"children":167},{},[168],{"type":50,"value":169},"    .package(url: \"https:\u002F\u002Fgithub.com\u002Frivet-dev\u002Frivetkit-swift\", from: \"2.0.0\")\n",{"type":44,"tag":142,"props":171,"children":173},{"class":144,"line":172},4,[174],{"type":44,"tag":142,"props":175,"children":176},{},[177],{"type":50,"value":178},"]\n",{"type":44,"tag":142,"props":180,"children":182},{"class":144,"line":181},5,[183],{"type":44,"tag":142,"props":184,"children":186},{"emptyLinePlaceholder":185},true,[187],{"type":50,"value":188},"\n",{"type":44,"tag":142,"props":190,"children":192},{"class":144,"line":191},6,[193],{"type":44,"tag":142,"props":194,"children":195},{},[196],{"type":50,"value":197},"targets: [\n",{"type":44,"tag":142,"props":199,"children":200},{"class":144,"line":31},[201],{"type":44,"tag":142,"props":202,"children":203},{},[204],{"type":50,"value":205},"    .target(\n",{"type":44,"tag":142,"props":207,"children":209},{"class":144,"line":208},8,[210],{"type":44,"tag":142,"props":211,"children":212},{},[213],{"type":50,"value":214},"        name: \"MyApp\",\n",{"type":44,"tag":142,"props":216,"children":218},{"class":144,"line":217},9,[219],{"type":44,"tag":142,"props":220,"children":221},{},[222],{"type":50,"value":223},"        dependencies: [\n",{"type":44,"tag":142,"props":225,"children":227},{"class":144,"line":226},10,[228],{"type":44,"tag":142,"props":229,"children":230},{},[231],{"type":50,"value":232},"            .product(name: \"RivetKitClient\", package: \"rivetkit-swift\")\n",{"type":44,"tag":142,"props":234,"children":236},{"class":144,"line":235},11,[237],{"type":44,"tag":142,"props":238,"children":239},{},[240],{"type":50,"value":241},"        ]\n",{"type":44,"tag":142,"props":243,"children":245},{"class":144,"line":244},12,[246],{"type":44,"tag":142,"props":247,"children":248},{},[249],{"type":50,"value":250},"    )\n",{"type":44,"tag":142,"props":252,"children":254},{"class":144,"line":253},13,[255],{"type":44,"tag":142,"props":256,"children":257},{},[258],{"type":50,"value":178},{"type":44,"tag":68,"props":260,"children":262},{"id":261},"minimal-client",[263],{"type":50,"value":264},"Minimal Client",{"type":44,"tag":266,"props":267,"children":269},"h3",{"id":268},"endpoint-url",[270],{"type":50,"value":271},"Endpoint URL",{"type":44,"tag":132,"props":273,"children":275},{"className":134,"code":274,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(\n    endpoint: \"https:\u002F\u002Fmy-namespace:pk_...@api.rivet.dev\"\n)\nlet client = RivetKitClient(config: config)\n\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\nlet count: Int = try await handle.action(\"increment\", 1, as: Int.self)\n",[276],{"type":44,"tag":59,"props":277,"children":278},{"__ignoreMap":136},[279,287,294,302,310,318,326,333,341],{"type":44,"tag":142,"props":280,"children":281},{"class":144,"line":145},[282],{"type":44,"tag":142,"props":283,"children":284},{},[285],{"type":50,"value":286},"import RivetKitClient\n",{"type":44,"tag":142,"props":288,"children":289},{"class":144,"line":154},[290],{"type":44,"tag":142,"props":291,"children":292},{"emptyLinePlaceholder":185},[293],{"type":50,"value":188},{"type":44,"tag":142,"props":295,"children":296},{"class":144,"line":163},[297],{"type":44,"tag":142,"props":298,"children":299},{},[300],{"type":50,"value":301},"let config = try ClientConfig(\n",{"type":44,"tag":142,"props":303,"children":304},{"class":144,"line":172},[305],{"type":44,"tag":142,"props":306,"children":307},{},[308],{"type":50,"value":309},"    endpoint: \"https:\u002F\u002Fmy-namespace:pk_...@api.rivet.dev\"\n",{"type":44,"tag":142,"props":311,"children":312},{"class":144,"line":181},[313],{"type":44,"tag":142,"props":314,"children":315},{},[316],{"type":50,"value":317},")\n",{"type":44,"tag":142,"props":319,"children":320},{"class":144,"line":191},[321],{"type":44,"tag":142,"props":322,"children":323},{},[324],{"type":50,"value":325},"let client = RivetKitClient(config: config)\n",{"type":44,"tag":142,"props":327,"children":328},{"class":144,"line":31},[329],{"type":44,"tag":142,"props":330,"children":331},{"emptyLinePlaceholder":185},[332],{"type":50,"value":188},{"type":44,"tag":142,"props":334,"children":335},{"class":144,"line":208},[336],{"type":44,"tag":142,"props":337,"children":338},{},[339],{"type":50,"value":340},"let handle = client.getOrCreate(\"counter\", [\"my-counter\"])\n",{"type":44,"tag":142,"props":342,"children":343},{"class":144,"line":217},[344],{"type":44,"tag":142,"props":345,"children":346},{},[347],{"type":50,"value":348},"let count: Int = try await handle.action(\"increment\", 1, as: Int.self)\n",{"type":44,"tag":266,"props":350,"children":352},{"id":351},"explicit-fields",[353],{"type":50,"value":354},"Explicit Fields",{"type":44,"tag":132,"props":356,"children":358},{"className":134,"code":357,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(\n    endpoint: \"https:\u002F\u002Fapi.rivet.dev\",\n    namespace: \"my-namespace\",\n    token: \"pk_...\"\n)\nlet client = RivetKitClient(config: config)\n\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\nlet count: Int = try await handle.action(\"increment\", 1, as: Int.self)\n",[359],{"type":44,"tag":59,"props":360,"children":361},{"__ignoreMap":136},[362,369,376,383,391,399,407,414,421,428,435],{"type":44,"tag":142,"props":363,"children":364},{"class":144,"line":145},[365],{"type":44,"tag":142,"props":366,"children":367},{},[368],{"type":50,"value":286},{"type":44,"tag":142,"props":370,"children":371},{"class":144,"line":154},[372],{"type":44,"tag":142,"props":373,"children":374},{"emptyLinePlaceholder":185},[375],{"type":50,"value":188},{"type":44,"tag":142,"props":377,"children":378},{"class":144,"line":163},[379],{"type":44,"tag":142,"props":380,"children":381},{},[382],{"type":50,"value":301},{"type":44,"tag":142,"props":384,"children":385},{"class":144,"line":172},[386],{"type":44,"tag":142,"props":387,"children":388},{},[389],{"type":50,"value":390},"    endpoint: \"https:\u002F\u002Fapi.rivet.dev\",\n",{"type":44,"tag":142,"props":392,"children":393},{"class":144,"line":181},[394],{"type":44,"tag":142,"props":395,"children":396},{},[397],{"type":50,"value":398},"    namespace: \"my-namespace\",\n",{"type":44,"tag":142,"props":400,"children":401},{"class":144,"line":191},[402],{"type":44,"tag":142,"props":403,"children":404},{},[405],{"type":50,"value":406},"    token: \"pk_...\"\n",{"type":44,"tag":142,"props":408,"children":409},{"class":144,"line":31},[410],{"type":44,"tag":142,"props":411,"children":412},{},[413],{"type":50,"value":317},{"type":44,"tag":142,"props":415,"children":416},{"class":144,"line":208},[417],{"type":44,"tag":142,"props":418,"children":419},{},[420],{"type":50,"value":325},{"type":44,"tag":142,"props":422,"children":423},{"class":144,"line":217},[424],{"type":44,"tag":142,"props":425,"children":426},{"emptyLinePlaceholder":185},[427],{"type":50,"value":188},{"type":44,"tag":142,"props":429,"children":430},{"class":144,"line":226},[431],{"type":44,"tag":142,"props":432,"children":433},{},[434],{"type":50,"value":340},{"type":44,"tag":142,"props":436,"children":437},{"class":144,"line":235},[438],{"type":44,"tag":142,"props":439,"children":440},{},[441],{"type":50,"value":348},{"type":44,"tag":68,"props":443,"children":445},{"id":444},"stateless-vs-stateful",[446],{"type":50,"value":447},"Stateless vs Stateful",{"type":44,"tag":132,"props":449,"children":451},{"className":134,"code":450,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\n\n\u002F\u002F Stateless: each call is independent\nlet current: Int = try await handle.action(\"getCount\", as: Int.self)\nprint(\"Current count: \\(current)\")\n\n\u002F\u002F Stateful: keep a connection open for realtime events\nlet conn = handle.connect()\n\n\u002F\u002F Subscribe to events using AsyncStream\nlet eventTask = Task {\n    for await count in await conn.events(\"count\", as: Int.self) {\n        print(\"Event: \\(count)\")\n    }\n}\n\n_ = try await conn.action(\"increment\", 1, as: Int.self)\n\neventTask.cancel()\nawait conn.dispose()\nawait client.dispose()\n",[452],{"type":44,"tag":59,"props":453,"children":454},{"__ignoreMap":136},[455,462,469,477,484,491,498,505,513,521,529,536,544,552,560,569,578,586,595,604,613,621,630,638,647,656],{"type":44,"tag":142,"props":456,"children":457},{"class":144,"line":145},[458],{"type":44,"tag":142,"props":459,"children":460},{},[461],{"type":50,"value":286},{"type":44,"tag":142,"props":463,"children":464},{"class":144,"line":154},[465],{"type":44,"tag":142,"props":466,"children":467},{"emptyLinePlaceholder":185},[468],{"type":50,"value":188},{"type":44,"tag":142,"props":470,"children":471},{"class":144,"line":163},[472],{"type":44,"tag":142,"props":473,"children":474},{},[475],{"type":50,"value":476},"let config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\n",{"type":44,"tag":142,"props":478,"children":479},{"class":144,"line":172},[480],{"type":44,"tag":142,"props":481,"children":482},{},[483],{"type":50,"value":325},{"type":44,"tag":142,"props":485,"children":486},{"class":144,"line":181},[487],{"type":44,"tag":142,"props":488,"children":489},{"emptyLinePlaceholder":185},[490],{"type":50,"value":188},{"type":44,"tag":142,"props":492,"children":493},{"class":144,"line":191},[494],{"type":44,"tag":142,"props":495,"children":496},{},[497],{"type":50,"value":340},{"type":44,"tag":142,"props":499,"children":500},{"class":144,"line":31},[501],{"type":44,"tag":142,"props":502,"children":503},{"emptyLinePlaceholder":185},[504],{"type":50,"value":188},{"type":44,"tag":142,"props":506,"children":507},{"class":144,"line":208},[508],{"type":44,"tag":142,"props":509,"children":510},{},[511],{"type":50,"value":512},"\u002F\u002F Stateless: each call is independent\n",{"type":44,"tag":142,"props":514,"children":515},{"class":144,"line":217},[516],{"type":44,"tag":142,"props":517,"children":518},{},[519],{"type":50,"value":520},"let current: Int = try await handle.action(\"getCount\", as: Int.self)\n",{"type":44,"tag":142,"props":522,"children":523},{"class":144,"line":226},[524],{"type":44,"tag":142,"props":525,"children":526},{},[527],{"type":50,"value":528},"print(\"Current count: \\(current)\")\n",{"type":44,"tag":142,"props":530,"children":531},{"class":144,"line":235},[532],{"type":44,"tag":142,"props":533,"children":534},{"emptyLinePlaceholder":185},[535],{"type":50,"value":188},{"type":44,"tag":142,"props":537,"children":538},{"class":144,"line":244},[539],{"type":44,"tag":142,"props":540,"children":541},{},[542],{"type":50,"value":543},"\u002F\u002F Stateful: keep a connection open for realtime events\n",{"type":44,"tag":142,"props":545,"children":546},{"class":144,"line":253},[547],{"type":44,"tag":142,"props":548,"children":549},{},[550],{"type":50,"value":551},"let conn = handle.connect()\n",{"type":44,"tag":142,"props":553,"children":555},{"class":144,"line":554},14,[556],{"type":44,"tag":142,"props":557,"children":558},{"emptyLinePlaceholder":185},[559],{"type":50,"value":188},{"type":44,"tag":142,"props":561,"children":563},{"class":144,"line":562},15,[564],{"type":44,"tag":142,"props":565,"children":566},{},[567],{"type":50,"value":568},"\u002F\u002F Subscribe to events using AsyncStream\n",{"type":44,"tag":142,"props":570,"children":572},{"class":144,"line":571},16,[573],{"type":44,"tag":142,"props":574,"children":575},{},[576],{"type":50,"value":577},"let eventTask = Task {\n",{"type":44,"tag":142,"props":579,"children":580},{"class":144,"line":27},[581],{"type":44,"tag":142,"props":582,"children":583},{},[584],{"type":50,"value":585},"    for await count in await conn.events(\"count\", as: Int.self) {\n",{"type":44,"tag":142,"props":587,"children":589},{"class":144,"line":588},18,[590],{"type":44,"tag":142,"props":591,"children":592},{},[593],{"type":50,"value":594},"        print(\"Event: \\(count)\")\n",{"type":44,"tag":142,"props":596,"children":598},{"class":144,"line":597},19,[599],{"type":44,"tag":142,"props":600,"children":601},{},[602],{"type":50,"value":603},"    }\n",{"type":44,"tag":142,"props":605,"children":607},{"class":144,"line":606},20,[608],{"type":44,"tag":142,"props":609,"children":610},{},[611],{"type":50,"value":612},"}\n",{"type":44,"tag":142,"props":614,"children":616},{"class":144,"line":615},21,[617],{"type":44,"tag":142,"props":618,"children":619},{"emptyLinePlaceholder":185},[620],{"type":50,"value":188},{"type":44,"tag":142,"props":622,"children":624},{"class":144,"line":623},22,[625],{"type":44,"tag":142,"props":626,"children":627},{},[628],{"type":50,"value":629},"_ = try await conn.action(\"increment\", 1, as: Int.self)\n",{"type":44,"tag":142,"props":631,"children":633},{"class":144,"line":632},23,[634],{"type":44,"tag":142,"props":635,"children":636},{"emptyLinePlaceholder":185},[637],{"type":50,"value":188},{"type":44,"tag":142,"props":639,"children":641},{"class":144,"line":640},24,[642],{"type":44,"tag":142,"props":643,"children":644},{},[645],{"type":50,"value":646},"eventTask.cancel()\n",{"type":44,"tag":142,"props":648,"children":650},{"class":144,"line":649},25,[651],{"type":44,"tag":142,"props":652,"children":653},{},[654],{"type":50,"value":655},"await conn.dispose()\n",{"type":44,"tag":142,"props":657,"children":659},{"class":144,"line":658},26,[660],{"type":44,"tag":142,"props":661,"children":662},{},[663],{"type":50,"value":664},"await client.dispose()\n",{"type":44,"tag":68,"props":666,"children":668},{"id":667},"getting-actors",[669],{"type":50,"value":670},"Getting Actors",{"type":44,"tag":132,"props":672,"children":674},{"className":134,"code":673,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nstruct GameInput: Encodable {\n    let mode: String\n}\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\n\u002F\u002F Get or create an actor\nlet room = client.getOrCreate(\"chatRoom\", [\"room-42\"])\n\n\u002F\u002F Get an existing actor (fails if not found)\nlet existing = client.get(\"chatRoom\", [\"room-42\"])\n\n\u002F\u002F Create a new actor with input\nlet created = try await client.create(\n    \"game\",\n    [\"game-1\"],\n    options: CreateOptions(input: GameInput(mode: \"ranked\"))\n)\n\n\u002F\u002F Get actor by ID\nlet byId = client.getForId(\"chatRoom\", \"actor-id\")\n\n\u002F\u002F Resolve actor ID\nlet resolvedId = try await room.resolve()\nprint(\"Resolved ID: \\(resolvedId)\")\n\nawait client.dispose()\n",[675],{"type":44,"tag":59,"props":676,"children":677},{"__ignoreMap":136},[678,685,692,700,708,715,722,729,736,743,751,759,766,774,782,789,797,805,813,821,829,836,843,851,859,866,874,883,892,900],{"type":44,"tag":142,"props":679,"children":680},{"class":144,"line":145},[681],{"type":44,"tag":142,"props":682,"children":683},{},[684],{"type":50,"value":286},{"type":44,"tag":142,"props":686,"children":687},{"class":144,"line":154},[688],{"type":44,"tag":142,"props":689,"children":690},{"emptyLinePlaceholder":185},[691],{"type":50,"value":188},{"type":44,"tag":142,"props":693,"children":694},{"class":144,"line":163},[695],{"type":44,"tag":142,"props":696,"children":697},{},[698],{"type":50,"value":699},"struct GameInput: Encodable {\n",{"type":44,"tag":142,"props":701,"children":702},{"class":144,"line":172},[703],{"type":44,"tag":142,"props":704,"children":705},{},[706],{"type":50,"value":707},"    let mode: String\n",{"type":44,"tag":142,"props":709,"children":710},{"class":144,"line":181},[711],{"type":44,"tag":142,"props":712,"children":713},{},[714],{"type":50,"value":612},{"type":44,"tag":142,"props":716,"children":717},{"class":144,"line":191},[718],{"type":44,"tag":142,"props":719,"children":720},{"emptyLinePlaceholder":185},[721],{"type":50,"value":188},{"type":44,"tag":142,"props":723,"children":724},{"class":144,"line":31},[725],{"type":44,"tag":142,"props":726,"children":727},{},[728],{"type":50,"value":476},{"type":44,"tag":142,"props":730,"children":731},{"class":144,"line":208},[732],{"type":44,"tag":142,"props":733,"children":734},{},[735],{"type":50,"value":325},{"type":44,"tag":142,"props":737,"children":738},{"class":144,"line":217},[739],{"type":44,"tag":142,"props":740,"children":741},{"emptyLinePlaceholder":185},[742],{"type":50,"value":188},{"type":44,"tag":142,"props":744,"children":745},{"class":144,"line":226},[746],{"type":44,"tag":142,"props":747,"children":748},{},[749],{"type":50,"value":750},"\u002F\u002F Get or create an actor\n",{"type":44,"tag":142,"props":752,"children":753},{"class":144,"line":235},[754],{"type":44,"tag":142,"props":755,"children":756},{},[757],{"type":50,"value":758},"let room = client.getOrCreate(\"chatRoom\", [\"room-42\"])\n",{"type":44,"tag":142,"props":760,"children":761},{"class":144,"line":244},[762],{"type":44,"tag":142,"props":763,"children":764},{"emptyLinePlaceholder":185},[765],{"type":50,"value":188},{"type":44,"tag":142,"props":767,"children":768},{"class":144,"line":253},[769],{"type":44,"tag":142,"props":770,"children":771},{},[772],{"type":50,"value":773},"\u002F\u002F Get an existing actor (fails if not found)\n",{"type":44,"tag":142,"props":775,"children":776},{"class":144,"line":554},[777],{"type":44,"tag":142,"props":778,"children":779},{},[780],{"type":50,"value":781},"let existing = client.get(\"chatRoom\", [\"room-42\"])\n",{"type":44,"tag":142,"props":783,"children":784},{"class":144,"line":562},[785],{"type":44,"tag":142,"props":786,"children":787},{"emptyLinePlaceholder":185},[788],{"type":50,"value":188},{"type":44,"tag":142,"props":790,"children":791},{"class":144,"line":571},[792],{"type":44,"tag":142,"props":793,"children":794},{},[795],{"type":50,"value":796},"\u002F\u002F Create a new actor with input\n",{"type":44,"tag":142,"props":798,"children":799},{"class":144,"line":27},[800],{"type":44,"tag":142,"props":801,"children":802},{},[803],{"type":50,"value":804},"let created = try await client.create(\n",{"type":44,"tag":142,"props":806,"children":807},{"class":144,"line":588},[808],{"type":44,"tag":142,"props":809,"children":810},{},[811],{"type":50,"value":812},"    \"game\",\n",{"type":44,"tag":142,"props":814,"children":815},{"class":144,"line":597},[816],{"type":44,"tag":142,"props":817,"children":818},{},[819],{"type":50,"value":820},"    [\"game-1\"],\n",{"type":44,"tag":142,"props":822,"children":823},{"class":144,"line":606},[824],{"type":44,"tag":142,"props":825,"children":826},{},[827],{"type":50,"value":828},"    options: CreateOptions(input: GameInput(mode: \"ranked\"))\n",{"type":44,"tag":142,"props":830,"children":831},{"class":144,"line":615},[832],{"type":44,"tag":142,"props":833,"children":834},{},[835],{"type":50,"value":317},{"type":44,"tag":142,"props":837,"children":838},{"class":144,"line":623},[839],{"type":44,"tag":142,"props":840,"children":841},{"emptyLinePlaceholder":185},[842],{"type":50,"value":188},{"type":44,"tag":142,"props":844,"children":845},{"class":144,"line":632},[846],{"type":44,"tag":142,"props":847,"children":848},{},[849],{"type":50,"value":850},"\u002F\u002F Get actor by ID\n",{"type":44,"tag":142,"props":852,"children":853},{"class":144,"line":640},[854],{"type":44,"tag":142,"props":855,"children":856},{},[857],{"type":50,"value":858},"let byId = client.getForId(\"chatRoom\", \"actor-id\")\n",{"type":44,"tag":142,"props":860,"children":861},{"class":144,"line":649},[862],{"type":44,"tag":142,"props":863,"children":864},{"emptyLinePlaceholder":185},[865],{"type":50,"value":188},{"type":44,"tag":142,"props":867,"children":868},{"class":144,"line":658},[869],{"type":44,"tag":142,"props":870,"children":871},{},[872],{"type":50,"value":873},"\u002F\u002F Resolve actor ID\n",{"type":44,"tag":142,"props":875,"children":877},{"class":144,"line":876},27,[878],{"type":44,"tag":142,"props":879,"children":880},{},[881],{"type":50,"value":882},"let resolvedId = try await room.resolve()\n",{"type":44,"tag":142,"props":884,"children":886},{"class":144,"line":885},28,[887],{"type":44,"tag":142,"props":888,"children":889},{},[890],{"type":50,"value":891},"print(\"Resolved ID: \\(resolvedId)\")\n",{"type":44,"tag":142,"props":893,"children":895},{"class":144,"line":894},29,[896],{"type":44,"tag":142,"props":897,"children":898},{"emptyLinePlaceholder":185},[899],{"type":50,"value":188},{"type":44,"tag":142,"props":901,"children":903},{"class":144,"line":902},30,[904],{"type":44,"tag":142,"props":905,"children":906},{},[907],{"type":50,"value":664},{"type":44,"tag":53,"props":909,"children":910},{},[911],{"type":50,"value":912},"Actions support positional overloads for 0–5 args:",{"type":44,"tag":132,"props":914,"children":916},{"className":134,"code":915,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\n\nlet count: Int = try await handle.action(\"getCount\")\nlet updated: String = try await handle.action(\"rename\", \"new-name\")\nlet ok: Bool = try await handle.action(\"setScore\", \"user-1\", 42)\n\nprint(\"Count: \\(count), Updated: \\(updated), OK: \\(ok)\")\nawait client.dispose()\n",[917],{"type":44,"tag":59,"props":918,"children":919},{"__ignoreMap":136},[920,927,934,941,948,955,962,970,978,986,993,1001],{"type":44,"tag":142,"props":921,"children":922},{"class":144,"line":145},[923],{"type":44,"tag":142,"props":924,"children":925},{},[926],{"type":50,"value":286},{"type":44,"tag":142,"props":928,"children":929},{"class":144,"line":154},[930],{"type":44,"tag":142,"props":931,"children":932},{"emptyLinePlaceholder":185},[933],{"type":50,"value":188},{"type":44,"tag":142,"props":935,"children":936},{"class":144,"line":163},[937],{"type":44,"tag":142,"props":938,"children":939},{},[940],{"type":50,"value":476},{"type":44,"tag":142,"props":942,"children":943},{"class":144,"line":172},[944],{"type":44,"tag":142,"props":945,"children":946},{},[947],{"type":50,"value":325},{"type":44,"tag":142,"props":949,"children":950},{"class":144,"line":181},[951],{"type":44,"tag":142,"props":952,"children":953},{},[954],{"type":50,"value":340},{"type":44,"tag":142,"props":956,"children":957},{"class":144,"line":191},[958],{"type":44,"tag":142,"props":959,"children":960},{"emptyLinePlaceholder":185},[961],{"type":50,"value":188},{"type":44,"tag":142,"props":963,"children":964},{"class":144,"line":31},[965],{"type":44,"tag":142,"props":966,"children":967},{},[968],{"type":50,"value":969},"let count: Int = try await handle.action(\"getCount\")\n",{"type":44,"tag":142,"props":971,"children":972},{"class":144,"line":208},[973],{"type":44,"tag":142,"props":974,"children":975},{},[976],{"type":50,"value":977},"let updated: String = try await handle.action(\"rename\", \"new-name\")\n",{"type":44,"tag":142,"props":979,"children":980},{"class":144,"line":217},[981],{"type":44,"tag":142,"props":982,"children":983},{},[984],{"type":50,"value":985},"let ok: Bool = try await handle.action(\"setScore\", \"user-1\", 42)\n",{"type":44,"tag":142,"props":987,"children":988},{"class":144,"line":226},[989],{"type":44,"tag":142,"props":990,"children":991},{"emptyLinePlaceholder":185},[992],{"type":50,"value":188},{"type":44,"tag":142,"props":994,"children":995},{"class":144,"line":235},[996],{"type":44,"tag":142,"props":997,"children":998},{},[999],{"type":50,"value":1000},"print(\"Count: \\(count), Updated: \\(updated), OK: \\(ok)\")\n",{"type":44,"tag":142,"props":1002,"children":1003},{"class":144,"line":244},[1004],{"type":44,"tag":142,"props":1005,"children":1006},{},[1007],{"type":50,"value":664},{"type":44,"tag":53,"props":1009,"children":1010},{},[1011],{"type":50,"value":1012},"If you need more than 5 arguments, use the raw JSON fallback:",{"type":44,"tag":132,"props":1014,"children":1016},{"className":134,"code":1015,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet handle = client.getOrCreate(\"counter\", [\"my-counter\"])\n\nlet args: [JSONValue] = [\n    .string(\"user-1\"),\n    .number(.int(42)),\n    .string(\"extra\"),\n    .string(\"more\"),\n    .string(\"args\"),\n    .string(\"here\")\n]\nlet ok: Bool = try await handle.action(\"setScore\", args: args, as: Bool.self)\nprint(\"OK: \\(ok)\")\n\nawait client.dispose()\n",[1017],{"type":44,"tag":59,"props":1018,"children":1019},{"__ignoreMap":136},[1020,1027,1034,1041,1048,1055,1062,1070,1078,1086,1094,1102,1110,1118,1125,1133,1141,1148],{"type":44,"tag":142,"props":1021,"children":1022},{"class":144,"line":145},[1023],{"type":44,"tag":142,"props":1024,"children":1025},{},[1026],{"type":50,"value":286},{"type":44,"tag":142,"props":1028,"children":1029},{"class":144,"line":154},[1030],{"type":44,"tag":142,"props":1031,"children":1032},{"emptyLinePlaceholder":185},[1033],{"type":50,"value":188},{"type":44,"tag":142,"props":1035,"children":1036},{"class":144,"line":163},[1037],{"type":44,"tag":142,"props":1038,"children":1039},{},[1040],{"type":50,"value":476},{"type":44,"tag":142,"props":1042,"children":1043},{"class":144,"line":172},[1044],{"type":44,"tag":142,"props":1045,"children":1046},{},[1047],{"type":50,"value":325},{"type":44,"tag":142,"props":1049,"children":1050},{"class":144,"line":181},[1051],{"type":44,"tag":142,"props":1052,"children":1053},{},[1054],{"type":50,"value":340},{"type":44,"tag":142,"props":1056,"children":1057},{"class":144,"line":191},[1058],{"type":44,"tag":142,"props":1059,"children":1060},{"emptyLinePlaceholder":185},[1061],{"type":50,"value":188},{"type":44,"tag":142,"props":1063,"children":1064},{"class":144,"line":31},[1065],{"type":44,"tag":142,"props":1066,"children":1067},{},[1068],{"type":50,"value":1069},"let args: [JSONValue] = [\n",{"type":44,"tag":142,"props":1071,"children":1072},{"class":144,"line":208},[1073],{"type":44,"tag":142,"props":1074,"children":1075},{},[1076],{"type":50,"value":1077},"    .string(\"user-1\"),\n",{"type":44,"tag":142,"props":1079,"children":1080},{"class":144,"line":217},[1081],{"type":44,"tag":142,"props":1082,"children":1083},{},[1084],{"type":50,"value":1085},"    .number(.int(42)),\n",{"type":44,"tag":142,"props":1087,"children":1088},{"class":144,"line":226},[1089],{"type":44,"tag":142,"props":1090,"children":1091},{},[1092],{"type":50,"value":1093},"    .string(\"extra\"),\n",{"type":44,"tag":142,"props":1095,"children":1096},{"class":144,"line":235},[1097],{"type":44,"tag":142,"props":1098,"children":1099},{},[1100],{"type":50,"value":1101},"    .string(\"more\"),\n",{"type":44,"tag":142,"props":1103,"children":1104},{"class":144,"line":244},[1105],{"type":44,"tag":142,"props":1106,"children":1107},{},[1108],{"type":50,"value":1109},"    .string(\"args\"),\n",{"type":44,"tag":142,"props":1111,"children":1112},{"class":144,"line":253},[1113],{"type":44,"tag":142,"props":1114,"children":1115},{},[1116],{"type":50,"value":1117},"    .string(\"here\")\n",{"type":44,"tag":142,"props":1119,"children":1120},{"class":144,"line":554},[1121],{"type":44,"tag":142,"props":1122,"children":1123},{},[1124],{"type":50,"value":178},{"type":44,"tag":142,"props":1126,"children":1127},{"class":144,"line":562},[1128],{"type":44,"tag":142,"props":1129,"children":1130},{},[1131],{"type":50,"value":1132},"let ok: Bool = try await handle.action(\"setScore\", args: args, as: Bool.self)\n",{"type":44,"tag":142,"props":1134,"children":1135},{"class":144,"line":571},[1136],{"type":44,"tag":142,"props":1137,"children":1138},{},[1139],{"type":50,"value":1140},"print(\"OK: \\(ok)\")\n",{"type":44,"tag":142,"props":1142,"children":1143},{"class":144,"line":27},[1144],{"type":44,"tag":142,"props":1145,"children":1146},{"emptyLinePlaceholder":185},[1147],{"type":50,"value":188},{"type":44,"tag":142,"props":1149,"children":1150},{"class":144,"line":588},[1151],{"type":44,"tag":142,"props":1152,"children":1153},{},[1154],{"type":50,"value":664},{"type":44,"tag":68,"props":1156,"children":1158},{"id":1157},"connection-parameters",[1159],{"type":50,"value":1160},"Connection Parameters",{"type":44,"tag":132,"props":1162,"children":1164},{"className":134,"code":1163,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nstruct ConnParams: Encodable {\n    let authToken: String\n}\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\nlet chat = client.getOrCreate(\n    \"chatRoom\",\n    [\"general\"],\n    options: GetOrCreateOptions(params: ConnParams(authToken: \"jwt-token-here\"))\n)\n\nlet conn = chat.connect()\n\n\u002F\u002F Use the connection...\nfor await status in await conn.statusChanges() {\n    print(\"Status: \\(status.rawValue)\")\n    if status == .connected {\n        break\n    }\n}\n\nawait conn.dispose()\nawait client.dispose()\n",[1165],{"type":44,"tag":59,"props":1166,"children":1167},{"__ignoreMap":136},[1168,1175,1182,1190,1198,1205,1212,1219,1226,1233,1241,1249,1257,1265,1272,1279,1287,1294,1302,1310,1318,1326,1334,1341,1348,1355,1362],{"type":44,"tag":142,"props":1169,"children":1170},{"class":144,"line":145},[1171],{"type":44,"tag":142,"props":1172,"children":1173},{},[1174],{"type":50,"value":286},{"type":44,"tag":142,"props":1176,"children":1177},{"class":144,"line":154},[1178],{"type":44,"tag":142,"props":1179,"children":1180},{"emptyLinePlaceholder":185},[1181],{"type":50,"value":188},{"type":44,"tag":142,"props":1183,"children":1184},{"class":144,"line":163},[1185],{"type":44,"tag":142,"props":1186,"children":1187},{},[1188],{"type":50,"value":1189},"struct ConnParams: Encodable {\n",{"type":44,"tag":142,"props":1191,"children":1192},{"class":144,"line":172},[1193],{"type":44,"tag":142,"props":1194,"children":1195},{},[1196],{"type":50,"value":1197},"    let authToken: String\n",{"type":44,"tag":142,"props":1199,"children":1200},{"class":144,"line":181},[1201],{"type":44,"tag":142,"props":1202,"children":1203},{},[1204],{"type":50,"value":612},{"type":44,"tag":142,"props":1206,"children":1207},{"class":144,"line":191},[1208],{"type":44,"tag":142,"props":1209,"children":1210},{"emptyLinePlaceholder":185},[1211],{"type":50,"value":188},{"type":44,"tag":142,"props":1213,"children":1214},{"class":144,"line":31},[1215],{"type":44,"tag":142,"props":1216,"children":1217},{},[1218],{"type":50,"value":476},{"type":44,"tag":142,"props":1220,"children":1221},{"class":144,"line":208},[1222],{"type":44,"tag":142,"props":1223,"children":1224},{},[1225],{"type":50,"value":325},{"type":44,"tag":142,"props":1227,"children":1228},{"class":144,"line":217},[1229],{"type":44,"tag":142,"props":1230,"children":1231},{"emptyLinePlaceholder":185},[1232],{"type":50,"value":188},{"type":44,"tag":142,"props":1234,"children":1235},{"class":144,"line":226},[1236],{"type":44,"tag":142,"props":1237,"children":1238},{},[1239],{"type":50,"value":1240},"let chat = client.getOrCreate(\n",{"type":44,"tag":142,"props":1242,"children":1243},{"class":144,"line":235},[1244],{"type":44,"tag":142,"props":1245,"children":1246},{},[1247],{"type":50,"value":1248},"    \"chatRoom\",\n",{"type":44,"tag":142,"props":1250,"children":1251},{"class":144,"line":244},[1252],{"type":44,"tag":142,"props":1253,"children":1254},{},[1255],{"type":50,"value":1256},"    [\"general\"],\n",{"type":44,"tag":142,"props":1258,"children":1259},{"class":144,"line":253},[1260],{"type":44,"tag":142,"props":1261,"children":1262},{},[1263],{"type":50,"value":1264},"    options: GetOrCreateOptions(params: ConnParams(authToken: \"jwt-token-here\"))\n",{"type":44,"tag":142,"props":1266,"children":1267},{"class":144,"line":554},[1268],{"type":44,"tag":142,"props":1269,"children":1270},{},[1271],{"type":50,"value":317},{"type":44,"tag":142,"props":1273,"children":1274},{"class":144,"line":562},[1275],{"type":44,"tag":142,"props":1276,"children":1277},{"emptyLinePlaceholder":185},[1278],{"type":50,"value":188},{"type":44,"tag":142,"props":1280,"children":1281},{"class":144,"line":571},[1282],{"type":44,"tag":142,"props":1283,"children":1284},{},[1285],{"type":50,"value":1286},"let conn = chat.connect()\n",{"type":44,"tag":142,"props":1288,"children":1289},{"class":144,"line":27},[1290],{"type":44,"tag":142,"props":1291,"children":1292},{"emptyLinePlaceholder":185},[1293],{"type":50,"value":188},{"type":44,"tag":142,"props":1295,"children":1296},{"class":144,"line":588},[1297],{"type":44,"tag":142,"props":1298,"children":1299},{},[1300],{"type":50,"value":1301},"\u002F\u002F Use the connection...\n",{"type":44,"tag":142,"props":1303,"children":1304},{"class":144,"line":597},[1305],{"type":44,"tag":142,"props":1306,"children":1307},{},[1308],{"type":50,"value":1309},"for await status in await conn.statusChanges() {\n",{"type":44,"tag":142,"props":1311,"children":1312},{"class":144,"line":606},[1313],{"type":44,"tag":142,"props":1314,"children":1315},{},[1316],{"type":50,"value":1317},"    print(\"Status: \\(status.rawValue)\")\n",{"type":44,"tag":142,"props":1319,"children":1320},{"class":144,"line":615},[1321],{"type":44,"tag":142,"props":1322,"children":1323},{},[1324],{"type":50,"value":1325},"    if status == .connected {\n",{"type":44,"tag":142,"props":1327,"children":1328},{"class":144,"line":623},[1329],{"type":44,"tag":142,"props":1330,"children":1331},{},[1332],{"type":50,"value":1333},"        break\n",{"type":44,"tag":142,"props":1335,"children":1336},{"class":144,"line":632},[1337],{"type":44,"tag":142,"props":1338,"children":1339},{},[1340],{"type":50,"value":603},{"type":44,"tag":142,"props":1342,"children":1343},{"class":144,"line":640},[1344],{"type":44,"tag":142,"props":1345,"children":1346},{},[1347],{"type":50,"value":612},{"type":44,"tag":142,"props":1349,"children":1350},{"class":144,"line":649},[1351],{"type":44,"tag":142,"props":1352,"children":1353},{"emptyLinePlaceholder":185},[1354],{"type":50,"value":188},{"type":44,"tag":142,"props":1356,"children":1357},{"class":144,"line":658},[1358],{"type":44,"tag":142,"props":1359,"children":1360},{},[1361],{"type":50,"value":655},{"type":44,"tag":142,"props":1363,"children":1364},{"class":144,"line":876},[1365],{"type":44,"tag":142,"props":1366,"children":1367},{},[1368],{"type":50,"value":664},{"type":44,"tag":68,"props":1370,"children":1372},{"id":1371},"subscribing-to-events",[1373],{"type":50,"value":1374},"Subscribing to Events",{"type":44,"tag":132,"props":1376,"children":1378},{"className":134,"code":1377,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet conn = client.getOrCreate(\"chatRoom\", [\"general\"]).connect()\n\n\u002F\u002F Subscribe to events using AsyncStream\nlet messageTask = Task {\n    for await (from, body) in await conn.events(\"message\", as: (String, String).self) {\n        print(\"\\(from): \\(body)\")\n    }\n}\n\n\u002F\u002F For one-time events, break after receiving\nlet gameOverTask = Task {\n    for await _ in await conn.events(\"gameOver\", as: Void.self) {\n        print(\"done\")\n        break\n    }\n}\n\n\u002F\u002F Let it run for a bit\ntry await Task.sleep(for: .seconds(5))\n\n\u002F\u002F Cancel when done\nmessageTask.cancel()\ngameOverTask.cancel()\nawait conn.dispose()\nawait client.dispose()\n",[1379],{"type":44,"tag":59,"props":1380,"children":1381},{"__ignoreMap":136},[1382,1389,1396,1403,1410,1418,1425,1432,1440,1448,1456,1463,1470,1477,1485,1493,1501,1509,1516,1523,1530,1537,1545,1553,1560,1568,1576,1584,1591],{"type":44,"tag":142,"props":1383,"children":1384},{"class":144,"line":145},[1385],{"type":44,"tag":142,"props":1386,"children":1387},{},[1388],{"type":50,"value":286},{"type":44,"tag":142,"props":1390,"children":1391},{"class":144,"line":154},[1392],{"type":44,"tag":142,"props":1393,"children":1394},{"emptyLinePlaceholder":185},[1395],{"type":50,"value":188},{"type":44,"tag":142,"props":1397,"children":1398},{"class":144,"line":163},[1399],{"type":44,"tag":142,"props":1400,"children":1401},{},[1402],{"type":50,"value":476},{"type":44,"tag":142,"props":1404,"children":1405},{"class":144,"line":172},[1406],{"type":44,"tag":142,"props":1407,"children":1408},{},[1409],{"type":50,"value":325},{"type":44,"tag":142,"props":1411,"children":1412},{"class":144,"line":181},[1413],{"type":44,"tag":142,"props":1414,"children":1415},{},[1416],{"type":50,"value":1417},"let conn = client.getOrCreate(\"chatRoom\", [\"general\"]).connect()\n",{"type":44,"tag":142,"props":1419,"children":1420},{"class":144,"line":191},[1421],{"type":44,"tag":142,"props":1422,"children":1423},{"emptyLinePlaceholder":185},[1424],{"type":50,"value":188},{"type":44,"tag":142,"props":1426,"children":1427},{"class":144,"line":31},[1428],{"type":44,"tag":142,"props":1429,"children":1430},{},[1431],{"type":50,"value":568},{"type":44,"tag":142,"props":1433,"children":1434},{"class":144,"line":208},[1435],{"type":44,"tag":142,"props":1436,"children":1437},{},[1438],{"type":50,"value":1439},"let messageTask = Task {\n",{"type":44,"tag":142,"props":1441,"children":1442},{"class":144,"line":217},[1443],{"type":44,"tag":142,"props":1444,"children":1445},{},[1446],{"type":50,"value":1447},"    for await (from, body) in await conn.events(\"message\", as: (String, String).self) {\n",{"type":44,"tag":142,"props":1449,"children":1450},{"class":144,"line":226},[1451],{"type":44,"tag":142,"props":1452,"children":1453},{},[1454],{"type":50,"value":1455},"        print(\"\\(from): \\(body)\")\n",{"type":44,"tag":142,"props":1457,"children":1458},{"class":144,"line":235},[1459],{"type":44,"tag":142,"props":1460,"children":1461},{},[1462],{"type":50,"value":603},{"type":44,"tag":142,"props":1464,"children":1465},{"class":144,"line":244},[1466],{"type":44,"tag":142,"props":1467,"children":1468},{},[1469],{"type":50,"value":612},{"type":44,"tag":142,"props":1471,"children":1472},{"class":144,"line":253},[1473],{"type":44,"tag":142,"props":1474,"children":1475},{"emptyLinePlaceholder":185},[1476],{"type":50,"value":188},{"type":44,"tag":142,"props":1478,"children":1479},{"class":144,"line":554},[1480],{"type":44,"tag":142,"props":1481,"children":1482},{},[1483],{"type":50,"value":1484},"\u002F\u002F For one-time events, break after receiving\n",{"type":44,"tag":142,"props":1486,"children":1487},{"class":144,"line":562},[1488],{"type":44,"tag":142,"props":1489,"children":1490},{},[1491],{"type":50,"value":1492},"let gameOverTask = Task {\n",{"type":44,"tag":142,"props":1494,"children":1495},{"class":144,"line":571},[1496],{"type":44,"tag":142,"props":1497,"children":1498},{},[1499],{"type":50,"value":1500},"    for await _ in await conn.events(\"gameOver\", as: Void.self) {\n",{"type":44,"tag":142,"props":1502,"children":1503},{"class":144,"line":27},[1504],{"type":44,"tag":142,"props":1505,"children":1506},{},[1507],{"type":50,"value":1508},"        print(\"done\")\n",{"type":44,"tag":142,"props":1510,"children":1511},{"class":144,"line":588},[1512],{"type":44,"tag":142,"props":1513,"children":1514},{},[1515],{"type":50,"value":1333},{"type":44,"tag":142,"props":1517,"children":1518},{"class":144,"line":597},[1519],{"type":44,"tag":142,"props":1520,"children":1521},{},[1522],{"type":50,"value":603},{"type":44,"tag":142,"props":1524,"children":1525},{"class":144,"line":606},[1526],{"type":44,"tag":142,"props":1527,"children":1528},{},[1529],{"type":50,"value":612},{"type":44,"tag":142,"props":1531,"children":1532},{"class":144,"line":615},[1533],{"type":44,"tag":142,"props":1534,"children":1535},{"emptyLinePlaceholder":185},[1536],{"type":50,"value":188},{"type":44,"tag":142,"props":1538,"children":1539},{"class":144,"line":623},[1540],{"type":44,"tag":142,"props":1541,"children":1542},{},[1543],{"type":50,"value":1544},"\u002F\u002F Let it run for a bit\n",{"type":44,"tag":142,"props":1546,"children":1547},{"class":144,"line":632},[1548],{"type":44,"tag":142,"props":1549,"children":1550},{},[1551],{"type":50,"value":1552},"try await Task.sleep(for: .seconds(5))\n",{"type":44,"tag":142,"props":1554,"children":1555},{"class":144,"line":640},[1556],{"type":44,"tag":142,"props":1557,"children":1558},{"emptyLinePlaceholder":185},[1559],{"type":50,"value":188},{"type":44,"tag":142,"props":1561,"children":1562},{"class":144,"line":649},[1563],{"type":44,"tag":142,"props":1564,"children":1565},{},[1566],{"type":50,"value":1567},"\u002F\u002F Cancel when done\n",{"type":44,"tag":142,"props":1569,"children":1570},{"class":144,"line":658},[1571],{"type":44,"tag":142,"props":1572,"children":1573},{},[1574],{"type":50,"value":1575},"messageTask.cancel()\n",{"type":44,"tag":142,"props":1577,"children":1578},{"class":144,"line":876},[1579],{"type":44,"tag":142,"props":1580,"children":1581},{},[1582],{"type":50,"value":1583},"gameOverTask.cancel()\n",{"type":44,"tag":142,"props":1585,"children":1586},{"class":144,"line":885},[1587],{"type":44,"tag":142,"props":1588,"children":1589},{},[1590],{"type":50,"value":655},{"type":44,"tag":142,"props":1592,"children":1593},{"class":144,"line":894},[1594],{"type":44,"tag":142,"props":1595,"children":1596},{},[1597],{"type":50,"value":664},{"type":44,"tag":53,"props":1599,"children":1600},{},[1601,1603,1609],{"type":50,"value":1602},"Event streams support 0–5 typed arguments. If you need raw values or more than 5 arguments, use ",{"type":44,"tag":59,"props":1604,"children":1606},{"className":1605},[],[1607],{"type":50,"value":1608},"JSONValue",{"type":50,"value":130},{"type":44,"tag":132,"props":1611,"children":1613},{"className":134,"code":1612,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet conn = client.getOrCreate(\"chatRoom\", [\"general\"]).connect()\n\nlet rawTask = Task {\n    for await args in await conn.events(\"message\") {\n        print(args)\n    }\n}\n\ntry await Task.sleep(for: .seconds(5))\nrawTask.cancel()\nawait conn.dispose()\nawait client.dispose()\n",[1614],{"type":44,"tag":59,"props":1615,"children":1616},{"__ignoreMap":136},[1617,1624,1631,1638,1645,1652,1659,1667,1675,1683,1690,1697,1704,1711,1719,1726],{"type":44,"tag":142,"props":1618,"children":1619},{"class":144,"line":145},[1620],{"type":44,"tag":142,"props":1621,"children":1622},{},[1623],{"type":50,"value":286},{"type":44,"tag":142,"props":1625,"children":1626},{"class":144,"line":154},[1627],{"type":44,"tag":142,"props":1628,"children":1629},{"emptyLinePlaceholder":185},[1630],{"type":50,"value":188},{"type":44,"tag":142,"props":1632,"children":1633},{"class":144,"line":163},[1634],{"type":44,"tag":142,"props":1635,"children":1636},{},[1637],{"type":50,"value":476},{"type":44,"tag":142,"props":1639,"children":1640},{"class":144,"line":172},[1641],{"type":44,"tag":142,"props":1642,"children":1643},{},[1644],{"type":50,"value":325},{"type":44,"tag":142,"props":1646,"children":1647},{"class":144,"line":181},[1648],{"type":44,"tag":142,"props":1649,"children":1650},{},[1651],{"type":50,"value":1417},{"type":44,"tag":142,"props":1653,"children":1654},{"class":144,"line":191},[1655],{"type":44,"tag":142,"props":1656,"children":1657},{"emptyLinePlaceholder":185},[1658],{"type":50,"value":188},{"type":44,"tag":142,"props":1660,"children":1661},{"class":144,"line":31},[1662],{"type":44,"tag":142,"props":1663,"children":1664},{},[1665],{"type":50,"value":1666},"let rawTask = Task {\n",{"type":44,"tag":142,"props":1668,"children":1669},{"class":144,"line":208},[1670],{"type":44,"tag":142,"props":1671,"children":1672},{},[1673],{"type":50,"value":1674},"    for await args in await conn.events(\"message\") {\n",{"type":44,"tag":142,"props":1676,"children":1677},{"class":144,"line":217},[1678],{"type":44,"tag":142,"props":1679,"children":1680},{},[1681],{"type":50,"value":1682},"        print(args)\n",{"type":44,"tag":142,"props":1684,"children":1685},{"class":144,"line":226},[1686],{"type":44,"tag":142,"props":1687,"children":1688},{},[1689],{"type":50,"value":603},{"type":44,"tag":142,"props":1691,"children":1692},{"class":144,"line":235},[1693],{"type":44,"tag":142,"props":1694,"children":1695},{},[1696],{"type":50,"value":612},{"type":44,"tag":142,"props":1698,"children":1699},{"class":144,"line":244},[1700],{"type":44,"tag":142,"props":1701,"children":1702},{"emptyLinePlaceholder":185},[1703],{"type":50,"value":188},{"type":44,"tag":142,"props":1705,"children":1706},{"class":144,"line":253},[1707],{"type":44,"tag":142,"props":1708,"children":1709},{},[1710],{"type":50,"value":1552},{"type":44,"tag":142,"props":1712,"children":1713},{"class":144,"line":554},[1714],{"type":44,"tag":142,"props":1715,"children":1716},{},[1717],{"type":50,"value":1718},"rawTask.cancel()\n",{"type":44,"tag":142,"props":1720,"children":1721},{"class":144,"line":562},[1722],{"type":44,"tag":142,"props":1723,"children":1724},{},[1725],{"type":50,"value":655},{"type":44,"tag":142,"props":1727,"children":1728},{"class":144,"line":571},[1729],{"type":44,"tag":142,"props":1730,"children":1731},{},[1732],{"type":50,"value":664},{"type":44,"tag":68,"props":1734,"children":1736},{"id":1735},"connection-lifecycle",[1737],{"type":50,"value":1738},"Connection Lifecycle",{"type":44,"tag":132,"props":1740,"children":1742},{"className":134,"code":1741,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet conn = client.getOrCreate(\"chatRoom\", [\"general\"]).connect()\n\n\u002F\u002F Monitor status changes (immediately yields current status)\nlet statusTask = Task {\n    for await status in await conn.statusChanges() {\n        print(\"status: \\(status.rawValue)\")\n    }\n}\n\n\u002F\u002F Monitor errors\nlet errorTask = Task {\n    for await error in await conn.errors() {\n        print(\"error: \\(error.group).\\(error.code)\")\n    }\n}\n\n\u002F\u002F Monitor open\u002Fclose events\nlet openTask = Task {\n    for await _ in await conn.opens() {\n        print(\"connected\")\n    }\n}\n\nlet closeTask = Task {\n    for await _ in await conn.closes() {\n        print(\"disconnected\")\n    }\n}\n\n\u002F\u002F Check current status\nlet current = await conn.currentStatus\nprint(\"Current status: \\(current.rawValue)\")\n\n\u002F\u002F Let it run for a bit\ntry await Task.sleep(for: .seconds(5))\n\n\u002F\u002F Cleanup\nstatusTask.cancel()\nerrorTask.cancel()\nopenTask.cancel()\ncloseTask.cancel()\nawait conn.dispose()\nawait client.dispose()\n",[1743],{"type":44,"tag":59,"props":1744,"children":1745},{"__ignoreMap":136},[1746,1753,1760,1767,1774,1781,1788,1796,1804,1812,1820,1827,1834,1841,1849,1857,1865,1873,1880,1887,1894,1902,1910,1918,1926,1933,1940,1947,1955,1963,1971,1979,1987,1995,2004,2013,2022,2030,2038,2046,2054,2063,2072,2081,2090,2099,2107],{"type":44,"tag":142,"props":1747,"children":1748},{"class":144,"line":145},[1749],{"type":44,"tag":142,"props":1750,"children":1751},{},[1752],{"type":50,"value":286},{"type":44,"tag":142,"props":1754,"children":1755},{"class":144,"line":154},[1756],{"type":44,"tag":142,"props":1757,"children":1758},{"emptyLinePlaceholder":185},[1759],{"type":50,"value":188},{"type":44,"tag":142,"props":1761,"children":1762},{"class":144,"line":163},[1763],{"type":44,"tag":142,"props":1764,"children":1765},{},[1766],{"type":50,"value":476},{"type":44,"tag":142,"props":1768,"children":1769},{"class":144,"line":172},[1770],{"type":44,"tag":142,"props":1771,"children":1772},{},[1773],{"type":50,"value":325},{"type":44,"tag":142,"props":1775,"children":1776},{"class":144,"line":181},[1777],{"type":44,"tag":142,"props":1778,"children":1779},{},[1780],{"type":50,"value":1417},{"type":44,"tag":142,"props":1782,"children":1783},{"class":144,"line":191},[1784],{"type":44,"tag":142,"props":1785,"children":1786},{"emptyLinePlaceholder":185},[1787],{"type":50,"value":188},{"type":44,"tag":142,"props":1789,"children":1790},{"class":144,"line":31},[1791],{"type":44,"tag":142,"props":1792,"children":1793},{},[1794],{"type":50,"value":1795},"\u002F\u002F Monitor status changes (immediately yields current status)\n",{"type":44,"tag":142,"props":1797,"children":1798},{"class":144,"line":208},[1799],{"type":44,"tag":142,"props":1800,"children":1801},{},[1802],{"type":50,"value":1803},"let statusTask = Task {\n",{"type":44,"tag":142,"props":1805,"children":1806},{"class":144,"line":217},[1807],{"type":44,"tag":142,"props":1808,"children":1809},{},[1810],{"type":50,"value":1811},"    for await status in await conn.statusChanges() {\n",{"type":44,"tag":142,"props":1813,"children":1814},{"class":144,"line":226},[1815],{"type":44,"tag":142,"props":1816,"children":1817},{},[1818],{"type":50,"value":1819},"        print(\"status: \\(status.rawValue)\")\n",{"type":44,"tag":142,"props":1821,"children":1822},{"class":144,"line":235},[1823],{"type":44,"tag":142,"props":1824,"children":1825},{},[1826],{"type":50,"value":603},{"type":44,"tag":142,"props":1828,"children":1829},{"class":144,"line":244},[1830],{"type":44,"tag":142,"props":1831,"children":1832},{},[1833],{"type":50,"value":612},{"type":44,"tag":142,"props":1835,"children":1836},{"class":144,"line":253},[1837],{"type":44,"tag":142,"props":1838,"children":1839},{"emptyLinePlaceholder":185},[1840],{"type":50,"value":188},{"type":44,"tag":142,"props":1842,"children":1843},{"class":144,"line":554},[1844],{"type":44,"tag":142,"props":1845,"children":1846},{},[1847],{"type":50,"value":1848},"\u002F\u002F Monitor errors\n",{"type":44,"tag":142,"props":1850,"children":1851},{"class":144,"line":562},[1852],{"type":44,"tag":142,"props":1853,"children":1854},{},[1855],{"type":50,"value":1856},"let errorTask = Task {\n",{"type":44,"tag":142,"props":1858,"children":1859},{"class":144,"line":571},[1860],{"type":44,"tag":142,"props":1861,"children":1862},{},[1863],{"type":50,"value":1864},"    for await error in await conn.errors() {\n",{"type":44,"tag":142,"props":1866,"children":1867},{"class":144,"line":27},[1868],{"type":44,"tag":142,"props":1869,"children":1870},{},[1871],{"type":50,"value":1872},"        print(\"error: \\(error.group).\\(error.code)\")\n",{"type":44,"tag":142,"props":1874,"children":1875},{"class":144,"line":588},[1876],{"type":44,"tag":142,"props":1877,"children":1878},{},[1879],{"type":50,"value":603},{"type":44,"tag":142,"props":1881,"children":1882},{"class":144,"line":597},[1883],{"type":44,"tag":142,"props":1884,"children":1885},{},[1886],{"type":50,"value":612},{"type":44,"tag":142,"props":1888,"children":1889},{"class":144,"line":606},[1890],{"type":44,"tag":142,"props":1891,"children":1892},{"emptyLinePlaceholder":185},[1893],{"type":50,"value":188},{"type":44,"tag":142,"props":1895,"children":1896},{"class":144,"line":615},[1897],{"type":44,"tag":142,"props":1898,"children":1899},{},[1900],{"type":50,"value":1901},"\u002F\u002F Monitor open\u002Fclose events\n",{"type":44,"tag":142,"props":1903,"children":1904},{"class":144,"line":623},[1905],{"type":44,"tag":142,"props":1906,"children":1907},{},[1908],{"type":50,"value":1909},"let openTask = Task {\n",{"type":44,"tag":142,"props":1911,"children":1912},{"class":144,"line":632},[1913],{"type":44,"tag":142,"props":1914,"children":1915},{},[1916],{"type":50,"value":1917},"    for await _ in await conn.opens() {\n",{"type":44,"tag":142,"props":1919,"children":1920},{"class":144,"line":640},[1921],{"type":44,"tag":142,"props":1922,"children":1923},{},[1924],{"type":50,"value":1925},"        print(\"connected\")\n",{"type":44,"tag":142,"props":1927,"children":1928},{"class":144,"line":649},[1929],{"type":44,"tag":142,"props":1930,"children":1931},{},[1932],{"type":50,"value":603},{"type":44,"tag":142,"props":1934,"children":1935},{"class":144,"line":658},[1936],{"type":44,"tag":142,"props":1937,"children":1938},{},[1939],{"type":50,"value":612},{"type":44,"tag":142,"props":1941,"children":1942},{"class":144,"line":876},[1943],{"type":44,"tag":142,"props":1944,"children":1945},{"emptyLinePlaceholder":185},[1946],{"type":50,"value":188},{"type":44,"tag":142,"props":1948,"children":1949},{"class":144,"line":885},[1950],{"type":44,"tag":142,"props":1951,"children":1952},{},[1953],{"type":50,"value":1954},"let closeTask = Task {\n",{"type":44,"tag":142,"props":1956,"children":1957},{"class":144,"line":894},[1958],{"type":44,"tag":142,"props":1959,"children":1960},{},[1961],{"type":50,"value":1962},"    for await _ in await conn.closes() {\n",{"type":44,"tag":142,"props":1964,"children":1965},{"class":144,"line":902},[1966],{"type":44,"tag":142,"props":1967,"children":1968},{},[1969],{"type":50,"value":1970},"        print(\"disconnected\")\n",{"type":44,"tag":142,"props":1972,"children":1974},{"class":144,"line":1973},31,[1975],{"type":44,"tag":142,"props":1976,"children":1977},{},[1978],{"type":50,"value":603},{"type":44,"tag":142,"props":1980,"children":1982},{"class":144,"line":1981},32,[1983],{"type":44,"tag":142,"props":1984,"children":1985},{},[1986],{"type":50,"value":612},{"type":44,"tag":142,"props":1988,"children":1990},{"class":144,"line":1989},33,[1991],{"type":44,"tag":142,"props":1992,"children":1993},{"emptyLinePlaceholder":185},[1994],{"type":50,"value":188},{"type":44,"tag":142,"props":1996,"children":1998},{"class":144,"line":1997},34,[1999],{"type":44,"tag":142,"props":2000,"children":2001},{},[2002],{"type":50,"value":2003},"\u002F\u002F Check current status\n",{"type":44,"tag":142,"props":2005,"children":2007},{"class":144,"line":2006},35,[2008],{"type":44,"tag":142,"props":2009,"children":2010},{},[2011],{"type":50,"value":2012},"let current = await conn.currentStatus\n",{"type":44,"tag":142,"props":2014,"children":2016},{"class":144,"line":2015},36,[2017],{"type":44,"tag":142,"props":2018,"children":2019},{},[2020],{"type":50,"value":2021},"print(\"Current status: \\(current.rawValue)\")\n",{"type":44,"tag":142,"props":2023,"children":2025},{"class":144,"line":2024},37,[2026],{"type":44,"tag":142,"props":2027,"children":2028},{"emptyLinePlaceholder":185},[2029],{"type":50,"value":188},{"type":44,"tag":142,"props":2031,"children":2033},{"class":144,"line":2032},38,[2034],{"type":44,"tag":142,"props":2035,"children":2036},{},[2037],{"type":50,"value":1544},{"type":44,"tag":142,"props":2039,"children":2041},{"class":144,"line":2040},39,[2042],{"type":44,"tag":142,"props":2043,"children":2044},{},[2045],{"type":50,"value":1552},{"type":44,"tag":142,"props":2047,"children":2049},{"class":144,"line":2048},40,[2050],{"type":44,"tag":142,"props":2051,"children":2052},{"emptyLinePlaceholder":185},[2053],{"type":50,"value":188},{"type":44,"tag":142,"props":2055,"children":2057},{"class":144,"line":2056},41,[2058],{"type":44,"tag":142,"props":2059,"children":2060},{},[2061],{"type":50,"value":2062},"\u002F\u002F Cleanup\n",{"type":44,"tag":142,"props":2064,"children":2066},{"class":144,"line":2065},42,[2067],{"type":44,"tag":142,"props":2068,"children":2069},{},[2070],{"type":50,"value":2071},"statusTask.cancel()\n",{"type":44,"tag":142,"props":2073,"children":2075},{"class":144,"line":2074},43,[2076],{"type":44,"tag":142,"props":2077,"children":2078},{},[2079],{"type":50,"value":2080},"errorTask.cancel()\n",{"type":44,"tag":142,"props":2082,"children":2084},{"class":144,"line":2083},44,[2085],{"type":44,"tag":142,"props":2086,"children":2087},{},[2088],{"type":50,"value":2089},"openTask.cancel()\n",{"type":44,"tag":142,"props":2091,"children":2093},{"class":144,"line":2092},45,[2094],{"type":44,"tag":142,"props":2095,"children":2096},{},[2097],{"type":50,"value":2098},"closeTask.cancel()\n",{"type":44,"tag":142,"props":2100,"children":2102},{"class":144,"line":2101},46,[2103],{"type":44,"tag":142,"props":2104,"children":2105},{},[2106],{"type":50,"value":655},{"type":44,"tag":142,"props":2108,"children":2110},{"class":144,"line":2109},47,[2111],{"type":44,"tag":142,"props":2112,"children":2113},{},[2114],{"type":50,"value":664},{"type":44,"tag":68,"props":2116,"children":2118},{"id":2117},"low-level-http-websocket",[2119],{"type":50,"value":2120},"Low-Level HTTP & WebSocket",{"type":44,"tag":53,"props":2122,"children":2123},{},[2124,2126,2132,2134,2140],{"type":50,"value":2125},"For actors that implement ",{"type":44,"tag":59,"props":2127,"children":2129},{"className":2128},[],[2130],{"type":50,"value":2131},"onRequest",{"type":50,"value":2133}," or ",{"type":44,"tag":59,"props":2135,"children":2137},{"className":2136},[],[2138],{"type":50,"value":2139},"onWebSocket",{"type":50,"value":2141},", you can call them directly:",{"type":44,"tag":132,"props":2143,"children":2145},{"className":134,"code":2144,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet handle = client.getOrCreate(\"chatRoom\", [\"general\"])\n\n\u002F\u002F Raw HTTP request\nlet response = try await handle.fetch(\"history\")\nlet history: [String] = try response.json([String].self)\nprint(\"History: \\(history)\")\n\n\u002F\u002F Raw WebSocket connection\nlet websocket = try await handle.websocket(path: \"stream\")\ntry await websocket.send(text: \"hello\")\nlet message = try await websocket.receive()\nprint(\"Received: \\(message)\")\n\nawait client.dispose()\n",[2146],{"type":44,"tag":59,"props":2147,"children":2148},{"__ignoreMap":136},[2149,2156,2163,2170,2177,2185,2192,2200,2208,2216,2224,2231,2239,2247,2255,2263,2271,2278],{"type":44,"tag":142,"props":2150,"children":2151},{"class":144,"line":145},[2152],{"type":44,"tag":142,"props":2153,"children":2154},{},[2155],{"type":50,"value":286},{"type":44,"tag":142,"props":2157,"children":2158},{"class":144,"line":154},[2159],{"type":44,"tag":142,"props":2160,"children":2161},{"emptyLinePlaceholder":185},[2162],{"type":50,"value":188},{"type":44,"tag":142,"props":2164,"children":2165},{"class":144,"line":163},[2166],{"type":44,"tag":142,"props":2167,"children":2168},{},[2169],{"type":50,"value":476},{"type":44,"tag":142,"props":2171,"children":2172},{"class":144,"line":172},[2173],{"type":44,"tag":142,"props":2174,"children":2175},{},[2176],{"type":50,"value":325},{"type":44,"tag":142,"props":2178,"children":2179},{"class":144,"line":181},[2180],{"type":44,"tag":142,"props":2181,"children":2182},{},[2183],{"type":50,"value":2184},"let handle = client.getOrCreate(\"chatRoom\", [\"general\"])\n",{"type":44,"tag":142,"props":2186,"children":2187},{"class":144,"line":191},[2188],{"type":44,"tag":142,"props":2189,"children":2190},{"emptyLinePlaceholder":185},[2191],{"type":50,"value":188},{"type":44,"tag":142,"props":2193,"children":2194},{"class":144,"line":31},[2195],{"type":44,"tag":142,"props":2196,"children":2197},{},[2198],{"type":50,"value":2199},"\u002F\u002F Raw HTTP request\n",{"type":44,"tag":142,"props":2201,"children":2202},{"class":144,"line":208},[2203],{"type":44,"tag":142,"props":2204,"children":2205},{},[2206],{"type":50,"value":2207},"let response = try await handle.fetch(\"history\")\n",{"type":44,"tag":142,"props":2209,"children":2210},{"class":144,"line":217},[2211],{"type":44,"tag":142,"props":2212,"children":2213},{},[2214],{"type":50,"value":2215},"let history: [String] = try response.json([String].self)\n",{"type":44,"tag":142,"props":2217,"children":2218},{"class":144,"line":226},[2219],{"type":44,"tag":142,"props":2220,"children":2221},{},[2222],{"type":50,"value":2223},"print(\"History: \\(history)\")\n",{"type":44,"tag":142,"props":2225,"children":2226},{"class":144,"line":235},[2227],{"type":44,"tag":142,"props":2228,"children":2229},{"emptyLinePlaceholder":185},[2230],{"type":50,"value":188},{"type":44,"tag":142,"props":2232,"children":2233},{"class":144,"line":244},[2234],{"type":44,"tag":142,"props":2235,"children":2236},{},[2237],{"type":50,"value":2238},"\u002F\u002F Raw WebSocket connection\n",{"type":44,"tag":142,"props":2240,"children":2241},{"class":144,"line":253},[2242],{"type":44,"tag":142,"props":2243,"children":2244},{},[2245],{"type":50,"value":2246},"let websocket = try await handle.websocket(path: \"stream\")\n",{"type":44,"tag":142,"props":2248,"children":2249},{"class":144,"line":554},[2250],{"type":44,"tag":142,"props":2251,"children":2252},{},[2253],{"type":50,"value":2254},"try await websocket.send(text: \"hello\")\n",{"type":44,"tag":142,"props":2256,"children":2257},{"class":144,"line":562},[2258],{"type":44,"tag":142,"props":2259,"children":2260},{},[2261],{"type":50,"value":2262},"let message = try await websocket.receive()\n",{"type":44,"tag":142,"props":2264,"children":2265},{"class":144,"line":571},[2266],{"type":44,"tag":142,"props":2267,"children":2268},{},[2269],{"type":50,"value":2270},"print(\"Received: \\(message)\")\n",{"type":44,"tag":142,"props":2272,"children":2273},{"class":144,"line":27},[2274],{"type":44,"tag":142,"props":2275,"children":2276},{"emptyLinePlaceholder":185},[2277],{"type":50,"value":188},{"type":44,"tag":142,"props":2279,"children":2280},{"class":144,"line":588},[2281],{"type":44,"tag":142,"props":2282,"children":2283},{},[2284],{"type":50,"value":664},{"type":44,"tag":68,"props":2286,"children":2288},{"id":2287},"calling-from-backend",[2289],{"type":50,"value":2290},"Calling from Backend",{"type":44,"tag":53,"props":2292,"children":2293},{},[2294],{"type":50,"value":2295},"Use the same client in server-side Swift (Vapor, Hummingbird, etc.):",{"type":44,"tag":132,"props":2297,"children":2299},{"className":134,"code":2298,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\nlet handle = client.getOrCreate(\"counter\", [\"server-counter\"])\nlet count: Int = try await handle.action(\"increment\", 1, as: Int.self)\nprint(\"Count: \\(count)\")\n\nawait client.dispose()\n",[2300],{"type":44,"tag":59,"props":2301,"children":2302},{"__ignoreMap":136},[2303,2310,2317,2324,2331,2338,2346,2353,2361,2368],{"type":44,"tag":142,"props":2304,"children":2305},{"class":144,"line":145},[2306],{"type":44,"tag":142,"props":2307,"children":2308},{},[2309],{"type":50,"value":286},{"type":44,"tag":142,"props":2311,"children":2312},{"class":144,"line":154},[2313],{"type":44,"tag":142,"props":2314,"children":2315},{"emptyLinePlaceholder":185},[2316],{"type":50,"value":188},{"type":44,"tag":142,"props":2318,"children":2319},{"class":144,"line":163},[2320],{"type":44,"tag":142,"props":2321,"children":2322},{},[2323],{"type":50,"value":476},{"type":44,"tag":142,"props":2325,"children":2326},{"class":144,"line":172},[2327],{"type":44,"tag":142,"props":2328,"children":2329},{},[2330],{"type":50,"value":325},{"type":44,"tag":142,"props":2332,"children":2333},{"class":144,"line":181},[2334],{"type":44,"tag":142,"props":2335,"children":2336},{"emptyLinePlaceholder":185},[2337],{"type":50,"value":188},{"type":44,"tag":142,"props":2339,"children":2340},{"class":144,"line":191},[2341],{"type":44,"tag":142,"props":2342,"children":2343},{},[2344],{"type":50,"value":2345},"let handle = client.getOrCreate(\"counter\", [\"server-counter\"])\n",{"type":44,"tag":142,"props":2347,"children":2348},{"class":144,"line":31},[2349],{"type":44,"tag":142,"props":2350,"children":2351},{},[2352],{"type":50,"value":348},{"type":44,"tag":142,"props":2354,"children":2355},{"class":144,"line":208},[2356],{"type":44,"tag":142,"props":2357,"children":2358},{},[2359],{"type":50,"value":2360},"print(\"Count: \\(count)\")\n",{"type":44,"tag":142,"props":2362,"children":2363},{"class":144,"line":217},[2364],{"type":44,"tag":142,"props":2365,"children":2366},{"emptyLinePlaceholder":185},[2367],{"type":50,"value":188},{"type":44,"tag":142,"props":2369,"children":2370},{"class":144,"line":226},[2371],{"type":44,"tag":142,"props":2372,"children":2373},{},[2374],{"type":50,"value":664},{"type":44,"tag":68,"props":2376,"children":2378},{"id":2377},"error-handling",[2379],{"type":50,"value":2380},"Error Handling",{"type":44,"tag":132,"props":2382,"children":2384},{"className":134,"code":2383,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\ndo {\n    _ = try await client.getOrCreate(\"user\", [\"user-123\"])\n        .action(\"updateUsername\", \"ab\", as: String.self)\n} catch let error as ActorError {\n    print(\"Error code: \\(error.code)\")\n    print(\"Metadata: \\(String(describing: error.metadata))\")\n}\n\nawait client.dispose()\n",[2385],{"type":44,"tag":59,"props":2386,"children":2387},{"__ignoreMap":136},[2388,2395,2402,2409,2416,2423,2431,2439,2447,2455,2463,2471,2478,2485],{"type":44,"tag":142,"props":2389,"children":2390},{"class":144,"line":145},[2391],{"type":44,"tag":142,"props":2392,"children":2393},{},[2394],{"type":50,"value":286},{"type":44,"tag":142,"props":2396,"children":2397},{"class":144,"line":154},[2398],{"type":44,"tag":142,"props":2399,"children":2400},{"emptyLinePlaceholder":185},[2401],{"type":50,"value":188},{"type":44,"tag":142,"props":2403,"children":2404},{"class":144,"line":163},[2405],{"type":44,"tag":142,"props":2406,"children":2407},{},[2408],{"type":50,"value":476},{"type":44,"tag":142,"props":2410,"children":2411},{"class":144,"line":172},[2412],{"type":44,"tag":142,"props":2413,"children":2414},{},[2415],{"type":50,"value":325},{"type":44,"tag":142,"props":2417,"children":2418},{"class":144,"line":181},[2419],{"type":44,"tag":142,"props":2420,"children":2421},{"emptyLinePlaceholder":185},[2422],{"type":50,"value":188},{"type":44,"tag":142,"props":2424,"children":2425},{"class":144,"line":191},[2426],{"type":44,"tag":142,"props":2427,"children":2428},{},[2429],{"type":50,"value":2430},"do {\n",{"type":44,"tag":142,"props":2432,"children":2433},{"class":144,"line":31},[2434],{"type":44,"tag":142,"props":2435,"children":2436},{},[2437],{"type":50,"value":2438},"    _ = try await client.getOrCreate(\"user\", [\"user-123\"])\n",{"type":44,"tag":142,"props":2440,"children":2441},{"class":144,"line":208},[2442],{"type":44,"tag":142,"props":2443,"children":2444},{},[2445],{"type":50,"value":2446},"        .action(\"updateUsername\", \"ab\", as: String.self)\n",{"type":44,"tag":142,"props":2448,"children":2449},{"class":144,"line":217},[2450],{"type":44,"tag":142,"props":2451,"children":2452},{},[2453],{"type":50,"value":2454},"} catch let error as ActorError {\n",{"type":44,"tag":142,"props":2456,"children":2457},{"class":144,"line":226},[2458],{"type":44,"tag":142,"props":2459,"children":2460},{},[2461],{"type":50,"value":2462},"    print(\"Error code: \\(error.code)\")\n",{"type":44,"tag":142,"props":2464,"children":2465},{"class":144,"line":235},[2466],{"type":44,"tag":142,"props":2467,"children":2468},{},[2469],{"type":50,"value":2470},"    print(\"Metadata: \\(String(describing: error.metadata))\")\n",{"type":44,"tag":142,"props":2472,"children":2473},{"class":144,"line":244},[2474],{"type":44,"tag":142,"props":2475,"children":2476},{},[2477],{"type":50,"value":612},{"type":44,"tag":142,"props":2479,"children":2480},{"class":144,"line":253},[2481],{"type":44,"tag":142,"props":2482,"children":2483},{"emptyLinePlaceholder":185},[2484],{"type":50,"value":188},{"type":44,"tag":142,"props":2486,"children":2487},{"class":144,"line":554},[2488],{"type":44,"tag":142,"props":2489,"children":2490},{},[2491],{"type":50,"value":664},{"type":44,"tag":53,"props":2493,"children":2494},{},[2495,2497,2502],{"type":50,"value":2496},"If you need an untyped response, you can decode to ",{"type":44,"tag":59,"props":2498,"children":2500},{"className":2499},[],[2501],{"type":50,"value":1608},{"type":50,"value":130},{"type":44,"tag":132,"props":2504,"children":2506},{"className":134,"code":2505,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\nlet handle = client.getOrCreate(\"data\", [\"raw\"])\n\nlet value: JSONValue = try await handle.action(\"getRawPayload\")\nprint(\"Raw value: \\(value)\")\n\nawait client.dispose()\n",[2507],{"type":44,"tag":59,"props":2508,"children":2509},{"__ignoreMap":136},[2510,2517,2524,2531,2538,2546,2553,2561,2569,2576],{"type":44,"tag":142,"props":2511,"children":2512},{"class":144,"line":145},[2513],{"type":44,"tag":142,"props":2514,"children":2515},{},[2516],{"type":50,"value":286},{"type":44,"tag":142,"props":2518,"children":2519},{"class":144,"line":154},[2520],{"type":44,"tag":142,"props":2521,"children":2522},{"emptyLinePlaceholder":185},[2523],{"type":50,"value":188},{"type":44,"tag":142,"props":2525,"children":2526},{"class":144,"line":163},[2527],{"type":44,"tag":142,"props":2528,"children":2529},{},[2530],{"type":50,"value":476},{"type":44,"tag":142,"props":2532,"children":2533},{"class":144,"line":172},[2534],{"type":44,"tag":142,"props":2535,"children":2536},{},[2537],{"type":50,"value":325},{"type":44,"tag":142,"props":2539,"children":2540},{"class":144,"line":181},[2541],{"type":44,"tag":142,"props":2542,"children":2543},{},[2544],{"type":50,"value":2545},"let handle = client.getOrCreate(\"data\", [\"raw\"])\n",{"type":44,"tag":142,"props":2547,"children":2548},{"class":144,"line":191},[2549],{"type":44,"tag":142,"props":2550,"children":2551},{"emptyLinePlaceholder":185},[2552],{"type":50,"value":188},{"type":44,"tag":142,"props":2554,"children":2555},{"class":144,"line":31},[2556],{"type":44,"tag":142,"props":2557,"children":2558},{},[2559],{"type":50,"value":2560},"let value: JSONValue = try await handle.action(\"getRawPayload\")\n",{"type":44,"tag":142,"props":2562,"children":2563},{"class":144,"line":208},[2564],{"type":44,"tag":142,"props":2565,"children":2566},{},[2567],{"type":50,"value":2568},"print(\"Raw value: \\(value)\")\n",{"type":44,"tag":142,"props":2570,"children":2571},{"class":144,"line":217},[2572],{"type":44,"tag":142,"props":2573,"children":2574},{"emptyLinePlaceholder":185},[2575],{"type":50,"value":188},{"type":44,"tag":142,"props":2577,"children":2578},{"class":144,"line":226},[2579],{"type":44,"tag":142,"props":2580,"children":2581},{},[2582],{"type":50,"value":664},{"type":44,"tag":68,"props":2584,"children":2586},{"id":2585},"concepts",[2587],{"type":50,"value":2588},"Concepts",{"type":44,"tag":266,"props":2590,"children":2592},{"id":2591},"keys",[2593],{"type":50,"value":2594},"Keys",{"type":44,"tag":53,"props":2596,"children":2597},{},[2598],{"type":50,"value":2599},"Keys uniquely identify actor instances. Use compound keys (arrays) for hierarchical addressing:",{"type":44,"tag":132,"props":2601,"children":2603},{"className":134,"code":2602,"language":23,"meta":136,"style":136},"import RivetKitClient\n\nlet config = try ClientConfig(endpoint: \"http:\u002F\u002Flocalhost:6420\")\nlet client = RivetKitClient(config: config)\n\n\u002F\u002F Use compound keys for hierarchical addressing\nlet room = client.getOrCreate(\"chatRoom\", [\"org-acme\", \"general\"])\nlet actorId = try await room.resolve()\nprint(\"Actor ID: \\(actorId)\")\n\nawait client.dispose()\n",[2604],{"type":44,"tag":59,"props":2605,"children":2606},{"__ignoreMap":136},[2607,2614,2621,2628,2635,2642,2650,2658,2666,2674,2681],{"type":44,"tag":142,"props":2608,"children":2609},{"class":144,"line":145},[2610],{"type":44,"tag":142,"props":2611,"children":2612},{},[2613],{"type":50,"value":286},{"type":44,"tag":142,"props":2615,"children":2616},{"class":144,"line":154},[2617],{"type":44,"tag":142,"props":2618,"children":2619},{"emptyLinePlaceholder":185},[2620],{"type":50,"value":188},{"type":44,"tag":142,"props":2622,"children":2623},{"class":144,"line":163},[2624],{"type":44,"tag":142,"props":2625,"children":2626},{},[2627],{"type":50,"value":476},{"type":44,"tag":142,"props":2629,"children":2630},{"class":144,"line":172},[2631],{"type":44,"tag":142,"props":2632,"children":2633},{},[2634],{"type":50,"value":325},{"type":44,"tag":142,"props":2636,"children":2637},{"class":144,"line":181},[2638],{"type":44,"tag":142,"props":2639,"children":2640},{"emptyLinePlaceholder":185},[2641],{"type":50,"value":188},{"type":44,"tag":142,"props":2643,"children":2644},{"class":144,"line":191},[2645],{"type":44,"tag":142,"props":2646,"children":2647},{},[2648],{"type":50,"value":2649},"\u002F\u002F Use compound keys for hierarchical addressing\n",{"type":44,"tag":142,"props":2651,"children":2652},{"class":144,"line":31},[2653],{"type":44,"tag":142,"props":2654,"children":2655},{},[2656],{"type":50,"value":2657},"let room = client.getOrCreate(\"chatRoom\", [\"org-acme\", \"general\"])\n",{"type":44,"tag":142,"props":2659,"children":2660},{"class":144,"line":208},[2661],{"type":44,"tag":142,"props":2662,"children":2663},{},[2664],{"type":50,"value":2665},"let actorId = try await room.resolve()\n",{"type":44,"tag":142,"props":2667,"children":2668},{"class":144,"line":217},[2669],{"type":44,"tag":142,"props":2670,"children":2671},{},[2672],{"type":50,"value":2673},"print(\"Actor ID: \\(actorId)\")\n",{"type":44,"tag":142,"props":2675,"children":2676},{"class":144,"line":226},[2677],{"type":44,"tag":142,"props":2678,"children":2679},{"emptyLinePlaceholder":185},[2680],{"type":50,"value":188},{"type":44,"tag":142,"props":2682,"children":2683},{"class":144,"line":235},[2684],{"type":44,"tag":142,"props":2685,"children":2686},{},[2687],{"type":50,"value":664},{"type":44,"tag":53,"props":2689,"children":2690},{},[2691,2693,2699,2701,2707],{"type":50,"value":2692},"Don't build keys with string interpolation like ",{"type":44,"tag":59,"props":2694,"children":2696},{"className":2695},[],[2697],{"type":50,"value":2698},"\"org:\\(userId)\"",{"type":50,"value":2700}," when ",{"type":44,"tag":59,"props":2702,"children":2704},{"className":2703},[],[2705],{"type":50,"value":2706},"userId",{"type":50,"value":2708}," contains user data. Use arrays instead to prevent key injection attacks.",{"type":44,"tag":266,"props":2710,"children":2712},{"id":2711},"environment-variables",[2713],{"type":50,"value":2714},"Environment Variables",{"type":44,"tag":53,"props":2716,"children":2717},{},[2718,2724],{"type":44,"tag":59,"props":2719,"children":2721},{"className":2720},[],[2722],{"type":50,"value":2723},"ClientConfig",{"type":50,"value":2725}," reads optional values from environment variables:",{"type":44,"tag":86,"props":2727,"children":2728},{},[2729,2740,2751],{"type":44,"tag":90,"props":2730,"children":2731},{},[2732,2738],{"type":44,"tag":59,"props":2733,"children":2735},{"className":2734},[],[2736],{"type":50,"value":2737},"RIVET_NAMESPACE",{"type":50,"value":2739}," - Namespace (can also be in endpoint URL)",{"type":44,"tag":90,"props":2741,"children":2742},{},[2743,2749],{"type":44,"tag":59,"props":2744,"children":2746},{"className":2745},[],[2747],{"type":50,"value":2748},"RIVET_TOKEN",{"type":50,"value":2750}," - Authentication token (can also be in endpoint URL)",{"type":44,"tag":90,"props":2752,"children":2753},{},[2754,2760,2762,2768],{"type":44,"tag":59,"props":2755,"children":2757},{"className":2756},[],[2758],{"type":50,"value":2759},"RIVET_RUNNER",{"type":50,"value":2761}," - Runner name (defaults to ",{"type":44,"tag":59,"props":2763,"children":2765},{"className":2764},[],[2766],{"type":50,"value":2767},"\"default\"",{"type":50,"value":2769},")",{"type":44,"tag":53,"props":2771,"children":2772},{},[2773,2775,2781],{"type":50,"value":2774},"The ",{"type":44,"tag":59,"props":2776,"children":2778},{"className":2777},[],[2779],{"type":50,"value":2780},"endpoint",{"type":50,"value":2782}," parameter is always required. There is no default endpoint.",{"type":44,"tag":266,"props":2784,"children":2786},{"id":2785},"endpoint-format",[2787],{"type":50,"value":2788},"Endpoint Format",{"type":44,"tag":53,"props":2790,"children":2791},{},[2792],{"type":50,"value":2793},"Endpoints support URL auth syntax:",{"type":44,"tag":132,"props":2795,"children":2799},{"className":2796,"code":2798,"language":50},[2797],"language-text","https:\u002F\u002Fnamespace:token@api.rivet.dev\n",[2800],{"type":44,"tag":59,"props":2801,"children":2802},{"__ignoreMap":136},[2803],{"type":50,"value":2798},{"type":44,"tag":53,"props":2805,"children":2806},{},[2807,2809,2814,2816,2821,2823,2829,2831,2838],{"type":50,"value":2808},"You can also pass the endpoint without auth and provide ",{"type":44,"tag":59,"props":2810,"children":2812},{"className":2811},[],[2813],{"type":50,"value":2737},{"type":50,"value":2815}," and ",{"type":44,"tag":59,"props":2817,"children":2819},{"className":2818},[],[2820],{"type":50,"value":2748},{"type":50,"value":2822}," separately. For serverless deployments, set the endpoint to your app's ",{"type":44,"tag":59,"props":2824,"children":2826},{"className":2825},[],[2827],{"type":50,"value":2828},"\u002Fapi\u002Frivet",{"type":50,"value":2830}," URL. See ",{"type":44,"tag":2832,"props":2833,"children":2835},"a",{"href":2834},"\u002Fdocs\u002Fgeneral\u002Fendpoints#url-auth-syntax",[2836],{"type":50,"value":2837},"Endpoints",{"type":50,"value":2839}," for details.",{"type":44,"tag":68,"props":2841,"children":2843},{"id":2842},"api-reference",[2844],{"type":50,"value":2845},"API Reference",{"type":44,"tag":266,"props":2847,"children":2849},{"id":2848},"client",[2850],{"type":50,"value":2851},"Client",{"type":44,"tag":86,"props":2853,"children":2854},{},[2855,2866,2876,2909],{"type":44,"tag":90,"props":2856,"children":2857},{},[2858,2864],{"type":44,"tag":59,"props":2859,"children":2861},{"className":2860},[],[2862],{"type":50,"value":2863},"RivetKitClient(config:)",{"type":50,"value":2865}," - Create a client with a config",{"type":44,"tag":90,"props":2867,"children":2868},{},[2869,2874],{"type":44,"tag":59,"props":2870,"children":2872},{"className":2871},[],[2873],{"type":50,"value":2723},{"type":50,"value":2875}," - Configure endpoint, namespace, and token",{"type":44,"tag":90,"props":2877,"children":2878},{},[2879,2885,2887,2893,2894,2900,2901,2907],{"type":44,"tag":59,"props":2880,"children":2882},{"className":2881},[],[2883],{"type":50,"value":2884},"client.get()",{"type":50,"value":2886}," \u002F ",{"type":44,"tag":59,"props":2888,"children":2890},{"className":2889},[],[2891],{"type":50,"value":2892},"getOrCreate()",{"type":50,"value":2886},{"type":44,"tag":59,"props":2895,"children":2897},{"className":2896},[],[2898],{"type":50,"value":2899},"getForId()",{"type":50,"value":2886},{"type":44,"tag":59,"props":2902,"children":2904},{"className":2903},[],[2905],{"type":50,"value":2906},"create()",{"type":50,"value":2908}," - Get actor handles",{"type":44,"tag":90,"props":2910,"children":2911},{},[2912,2918],{"type":44,"tag":59,"props":2913,"children":2915},{"className":2914},[],[2916],{"type":50,"value":2917},"client.dispose()",{"type":50,"value":2919}," - Dispose the client and all connections",{"type":44,"tag":266,"props":2921,"children":2923},{"id":2922},"actorhandle",[2924],{"type":50,"value":2925},"ActorHandle",{"type":44,"tag":86,"props":2927,"children":2928},{},[2929,2940,2951,2962,2973,2984],{"type":44,"tag":90,"props":2930,"children":2931},{},[2932,2938],{"type":44,"tag":59,"props":2933,"children":2935},{"className":2934},[],[2936],{"type":50,"value":2937},"handle.action(name, args..., as:)",{"type":50,"value":2939}," - Stateless action call",{"type":44,"tag":90,"props":2941,"children":2942},{},[2943,2949],{"type":44,"tag":59,"props":2944,"children":2946},{"className":2945},[],[2947],{"type":50,"value":2948},"handle.connect()",{"type":50,"value":2950}," - Create a stateful connection",{"type":44,"tag":90,"props":2952,"children":2953},{},[2954,2960],{"type":44,"tag":59,"props":2955,"children":2957},{"className":2956},[],[2958],{"type":50,"value":2959},"handle.resolve()",{"type":50,"value":2961}," - Get the actor ID",{"type":44,"tag":90,"props":2963,"children":2964},{},[2965,2971],{"type":44,"tag":59,"props":2966,"children":2968},{"className":2967},[],[2969],{"type":50,"value":2970},"handle.getGatewayUrl()",{"type":50,"value":2972}," - Get the raw gateway URL",{"type":44,"tag":90,"props":2974,"children":2975},{},[2976,2982],{"type":44,"tag":59,"props":2977,"children":2979},{"className":2978},[],[2980],{"type":50,"value":2981},"handle.fetch(path, request:)",{"type":50,"value":2983}," - Raw HTTP request",{"type":44,"tag":90,"props":2985,"children":2986},{},[2987,2993],{"type":44,"tag":59,"props":2988,"children":2990},{"className":2989},[],[2991],{"type":50,"value":2992},"handle.websocket(path:)",{"type":50,"value":2994}," - Raw WebSocket connection",{"type":44,"tag":266,"props":2996,"children":2998},{"id":2997},"actorconnection",[2999],{"type":50,"value":3000},"ActorConnection",{"type":44,"tag":86,"props":3002,"children":3003},{},[3004,3015,3026,3037,3048,3059,3070,3081],{"type":44,"tag":90,"props":3005,"children":3006},{},[3007,3013],{"type":44,"tag":59,"props":3008,"children":3010},{"className":3009},[],[3011],{"type":50,"value":3012},"conn.action(name, args..., as:)",{"type":50,"value":3014}," - Action call over WebSocket",{"type":44,"tag":90,"props":3016,"children":3017},{},[3018,3024],{"type":44,"tag":59,"props":3019,"children":3021},{"className":3020},[],[3022],{"type":50,"value":3023},"conn.events(name, as:)",{"type":50,"value":3025}," - AsyncStream of typed events",{"type":44,"tag":90,"props":3027,"children":3028},{},[3029,3035],{"type":44,"tag":59,"props":3030,"children":3032},{"className":3031},[],[3033],{"type":50,"value":3034},"conn.statusChanges()",{"type":50,"value":3036}," - AsyncStream of status changes",{"type":44,"tag":90,"props":3038,"children":3039},{},[3040,3046],{"type":44,"tag":59,"props":3041,"children":3043},{"className":3042},[],[3044],{"type":50,"value":3045},"conn.errors()",{"type":50,"value":3047}," - AsyncStream of connection errors",{"type":44,"tag":90,"props":3049,"children":3050},{},[3051,3057],{"type":44,"tag":59,"props":3052,"children":3054},{"className":3053},[],[3055],{"type":50,"value":3056},"conn.opens()",{"type":50,"value":3058}," - AsyncStream that yields on connection open",{"type":44,"tag":90,"props":3060,"children":3061},{},[3062,3068],{"type":44,"tag":59,"props":3063,"children":3065},{"className":3064},[],[3066],{"type":50,"value":3067},"conn.closes()",{"type":50,"value":3069}," - AsyncStream that yields on connection close",{"type":44,"tag":90,"props":3071,"children":3072},{},[3073,3079],{"type":44,"tag":59,"props":3074,"children":3076},{"className":3075},[],[3077],{"type":50,"value":3078},"conn.currentStatus",{"type":50,"value":3080}," - Current connection status",{"type":44,"tag":90,"props":3082,"children":3083},{},[3084,3090],{"type":44,"tag":59,"props":3085,"children":3087},{"className":3086},[],[3088],{"type":50,"value":3089},"conn.dispose()",{"type":50,"value":3091}," - Close the connection",{"type":44,"tag":266,"props":3093,"children":3095},{"id":3094},"types",[3096],{"type":50,"value":3097},"Types",{"type":44,"tag":86,"props":3099,"children":3100},{},[3101,3148,3185],{"type":44,"tag":90,"props":3102,"children":3103},{},[3104,3110,3112,3118,3120,3126,3127,3133,3134,3140,3141,3147],{"type":44,"tag":59,"props":3105,"children":3107},{"className":3106},[],[3108],{"type":50,"value":3109},"ActorConnStatus",{"type":50,"value":3111}," - Connection status enum (",{"type":44,"tag":59,"props":3113,"children":3115},{"className":3114},[],[3116],{"type":50,"value":3117},".idle",{"type":50,"value":3119},", ",{"type":44,"tag":59,"props":3121,"children":3123},{"className":3122},[],[3124],{"type":50,"value":3125},".connecting",{"type":50,"value":3119},{"type":44,"tag":59,"props":3128,"children":3130},{"className":3129},[],[3131],{"type":50,"value":3132},".connected",{"type":50,"value":3119},{"type":44,"tag":59,"props":3135,"children":3137},{"className":3136},[],[3138],{"type":50,"value":3139},".disconnected",{"type":50,"value":3119},{"type":44,"tag":59,"props":3142,"children":3144},{"className":3143},[],[3145],{"type":50,"value":3146},".disposed",{"type":50,"value":2769},{"type":44,"tag":90,"props":3149,"children":3150},{},[3151,3157,3159,3165,3166,3171,3172,3178,3179],{"type":44,"tag":59,"props":3152,"children":3154},{"className":3153},[],[3155],{"type":50,"value":3156},"ActorError",{"type":50,"value":3158}," - Typed actor errors with ",{"type":44,"tag":59,"props":3160,"children":3162},{"className":3161},[],[3163],{"type":50,"value":3164},"group",{"type":50,"value":3119},{"type":44,"tag":59,"props":3167,"children":3169},{"className":3168},[],[3170],{"type":50,"value":59},{"type":50,"value":3119},{"type":44,"tag":59,"props":3173,"children":3175},{"className":3174},[],[3176],{"type":50,"value":3177},"message",{"type":50,"value":3119},{"type":44,"tag":59,"props":3180,"children":3182},{"className":3181},[],[3183],{"type":50,"value":3184},"metadata",{"type":44,"tag":90,"props":3186,"children":3187},{},[3188,3193],{"type":44,"tag":59,"props":3189,"children":3191},{"className":3190},[],[3192],{"type":50,"value":1608},{"type":50,"value":3194}," - Raw JSON value for untyped responses",{"type":44,"tag":68,"props":3196,"children":3198},{"id":3197},"need-more-than-the-client",[3199],{"type":50,"value":3200},"Need More Than the Client?",{"type":44,"tag":53,"props":3202,"children":3203},{},[3204],{"type":50,"value":3205},"If you need more about Rivet Actors, registries, or server-side RivetKit, add the main skill:",{"type":44,"tag":132,"props":3207,"children":3211},{"className":3208,"code":3209,"language":3210,"meta":136,"style":136},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","npx skills add rivet-dev\u002Fskills\n","bash",[3212],{"type":44,"tag":59,"props":3213,"children":3214},{"__ignoreMap":136},[3215],{"type":44,"tag":142,"props":3216,"children":3217},{"class":144,"line":145},[3218,3224,3230,3235],{"type":44,"tag":142,"props":3219,"children":3221},{"style":3220},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[3222],{"type":50,"value":3223},"npx",{"type":44,"tag":142,"props":3225,"children":3227},{"style":3226},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[3228],{"type":50,"value":3229}," skills",{"type":44,"tag":142,"props":3231,"children":3232},{"style":3226},[3233],{"type":50,"value":3234}," add",{"type":44,"tag":142,"props":3236,"children":3237},{"style":3226},[3238],{"type":50,"value":3239}," rivet-dev\u002Fskills\n",{"type":44,"tag":53,"props":3241,"children":3242},{},[3243,3245,3251],{"type":50,"value":3244},"Then use the ",{"type":44,"tag":59,"props":3246,"children":3248},{"className":3247},[],[3249],{"type":50,"value":3250},"rivetkit",{"type":50,"value":3252}," skill for backend guidance.",{"type":44,"tag":3254,"props":3255,"children":3256},"style",{},[3257],{"type":50,"value":3258},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":3260,"total":27},[3261,3284,3302,3321,3337,3353,3370,3388,3406,3421,3435,3451],{"slug":3262,"name":3262,"fn":3263,"description":3264,"org":3265,"tags":3266,"stars":27,"repoUrl":28,"updatedAt":3283},"ai-agent","build AI agent backends with Rivet","Build an AI agent backend with persistent memory: one Rivet Actor per conversation, queued message handling, and streaming LLM responses as realtime events.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3267,3270,3273,3276,3279,3282],{"name":3268,"slug":3269,"type":14},"Agents","agents",{"name":3271,"slug":3272,"type":14},"Backend","backend",{"name":3274,"slug":3275,"type":14},"LLM","llm",{"name":3277,"slug":3278,"type":14},"Memory","memory",{"name":3280,"slug":3281,"type":14},"Real-time","real-time",{"name":9,"slug":8,"type":14},"2026-07-21T05:37:45.411803",{"slug":3285,"name":3285,"fn":3286,"description":3287,"org":3288,"tags":3289,"stars":27,"repoUrl":28,"updatedAt":3301},"ai-agent-workspace","create persistent workspaces for AI agents","Give every AI agent its own computer: a persistent workspace with a filesystem, processes, shells, networking, and agent sessions on a lightweight in-process OS.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3290,3291,3294,3297,3298],{"name":3268,"slug":3269,"type":14},{"name":3292,"slug":3293,"type":14},"File Storage","file-storage",{"name":3295,"slug":3296,"type":14},"Infrastructure","infrastructure",{"name":9,"slug":8,"type":14},{"name":3299,"slug":3300,"type":14},"Sandboxing","sandboxing","2026-06-14T08:06:57.274844",{"slug":3303,"name":3303,"fn":3304,"description":3305,"org":3306,"tags":3307,"stars":27,"repoUrl":28,"updatedAt":3320},"chat-room","build realtime chat rooms with Rivet","Build a realtime chat room backend with Rivet Actors: one actor per room, SQLite-backed message history, and WebSocket broadcast to every connected client.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3308,3309,3312,3313,3314,3317],{"name":3271,"slug":3272,"type":14},{"name":3310,"slug":3311,"type":14},"Messaging","messaging",{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14},{"name":3315,"slug":3316,"type":14},"SQL","sql",{"name":3318,"slug":3319,"type":14},"WebSockets","websockets","2026-07-21T05:37:48.403494",{"slug":3322,"name":3322,"fn":3323,"description":3324,"org":3325,"tags":3326,"stars":27,"repoUrl":28,"updatedAt":3336},"collaborative-text-editor","build collaborative text editors with Rivet","Build a collaborative text editor backend with Yjs CRDTs and Rivet Actors: per-document actors relay sync and awareness updates and persist snapshots.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3327,3328,3331,3334,3335],{"name":3271,"slug":3272,"type":14},{"name":3329,"slug":3330,"type":14},"Collaboration","collaboration",{"name":3332,"slug":3333,"type":14},"Documents","documents",{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14},"2026-07-21T05:37:49.412829",{"slug":3338,"name":3338,"fn":3339,"description":3340,"org":3341,"tags":3342,"stars":27,"repoUrl":28,"updatedAt":3352},"cron-jobs","schedule durable cron jobs with Rivet","Patterns for durable one-shot, calendar, and fixed-interval work on Rivet Actors.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3343,3346,3347,3348,3349],{"name":3344,"slug":3345,"type":14},"Automation","automation",{"name":3271,"slug":3272,"type":14},{"name":3295,"slug":3296,"type":14},{"name":9,"slug":8,"type":14},{"name":3350,"slug":3351,"type":14},"Scheduling","scheduling","2026-07-21T05:37:43.395911",{"slug":3354,"name":3354,"fn":3355,"description":3356,"org":3357,"tags":3358,"stars":27,"repoUrl":28,"updatedAt":3369},"live-cursors","implement live cursors and multiplayer presence","Live cursors and multiplayer presence with Rivet Actors: per-connection cursor state, realtime updates over events or raw WebSockets, and throttling.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3359,3360,3363,3364,3365,3368],{"name":3329,"slug":3330,"type":14},{"name":3361,"slug":3362,"type":14},"Frontend","frontend",{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14},{"name":3366,"slug":3367,"type":14},"UX Design","ux-design",{"name":3318,"slug":3319,"type":14},"2026-07-21T05:37:47.391088",{"slug":3371,"name":3371,"fn":3372,"description":3373,"org":3374,"tags":3375,"stars":27,"repoUrl":28,"updatedAt":3387},"multiplayer-game","build multiplayer games with Rivet","Pragmatic patterns for building multiplayer games: matchmaking, tick loops, realtime state, interest management, and validation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3376,3379,3382,3385,3386],{"name":3377,"slug":3378,"type":14},"Architecture","architecture",{"name":3380,"slug":3381,"type":14},"Engineering","engineering",{"name":3383,"slug":3384,"type":14},"Game Development","game-development",{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14},"2026-07-21T05:37:44.627991",{"slug":3389,"name":3389,"fn":3390,"description":3391,"org":3392,"tags":3393,"stars":27,"repoUrl":28,"updatedAt":3405},"per-tenant-database","implement multi-tenant data isolation with Rivet","Multi-tenant data isolation with one Rivet Actor per tenant: the actor key is the tenant id, so each tenant gets its own isolated dataset and migrations.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3394,3395,3398,3401,3404],{"name":3377,"slug":3378,"type":14},{"name":3396,"slug":3397,"type":14},"Database","database",{"name":3399,"slug":3400,"type":14},"Migration","migration",{"name":3402,"slug":3403,"type":14},"Multi-Tenant","multi-tenant",{"name":9,"slug":8,"type":14},"2026-07-21T05:37:46.414425",{"slug":3250,"name":3250,"fn":3407,"description":3408,"org":3409,"tags":3410,"stars":27,"repoUrl":28,"updatedAt":3420},"build and debug Rivet Actors","RivetKit backend and Rivet Actor runtime guidance. Use for building, modifying, debugging, or testing Rivet Actors, registries, serverless\u002Frunner modes, deployment, or actor-based workflows.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3411,3412,3413,3416,3419],{"name":3268,"slug":3269,"type":14},{"name":3271,"slug":3272,"type":14},{"name":3414,"slug":3415,"type":14},"Debugging","debugging",{"name":3417,"slug":3418,"type":14},"Deployment","deployment",{"name":9,"slug":8,"type":14},"2026-07-24T05:38:58.10133",{"slug":3422,"name":3422,"fn":3423,"description":3424,"org":3425,"tags":3426,"stars":27,"repoUrl":28,"updatedAt":3434},"rivetkit-client-javascript","use RivetKit JavaScript client","RivetKit JavaScript client guidance. Use for browser, Node.js, or Bun clients that connect to Rivet Actors with rivetkit\u002Fclient, create clients, call actions, or manage connections.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3427,3428,3429,3432,3433],{"name":3271,"slug":3272,"type":14},{"name":3361,"slug":3362,"type":14},{"name":3430,"slug":3431,"type":14},"JavaScript","javascript",{"name":9,"slug":8,"type":14},{"name":25,"slug":26,"type":14},"2026-07-30T05:31:37.725576",{"slug":3436,"name":3436,"fn":3437,"description":3438,"org":3439,"tags":3440,"stars":27,"repoUrl":28,"updatedAt":3450},"rivetkit-client-react","use RivetKit React client","RivetKit React client guidance. Use for React apps that connect to Rivet Actors with @rivetkit\u002Freact, create hooks with createRivetKit, or manage realtime state with useActor.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3441,3442,3445,3446,3447],{"name":3361,"slug":3362,"type":14},{"name":3443,"slug":3444,"type":14},"React","react",{"name":9,"slug":8,"type":14},{"name":25,"slug":26,"type":14},{"name":3448,"slug":3449,"type":14},"State Management","state-management","2026-07-30T05:31:36.618873",{"slug":3452,"name":3452,"fn":3453,"description":3454,"org":3455,"tags":3456,"stars":27,"repoUrl":28,"updatedAt":3464},"rivetkit-client-rust","build RivetKit Rust clients","RivetKit Rust client guidance. Use for Rust clients and backends that connect to Rivet Actors with rivetkit::client, create typed actor handles, call actions, or manage connections.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3457,3460,3461],{"name":3458,"slug":3459,"type":14},"API Development","api-development",{"name":3271,"slug":3272,"type":14},{"name":3462,"slug":3463,"type":14},"Rust","rust","2026-07-24T05:39:02.105888",{"items":3466,"total":571},[3467,3476,3484,3493,3501,3509,3518],{"slug":3262,"name":3262,"fn":3263,"description":3264,"org":3468,"tags":3469,"stars":27,"repoUrl":28,"updatedAt":3283},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3470,3471,3472,3473,3474,3475],{"name":3268,"slug":3269,"type":14},{"name":3271,"slug":3272,"type":14},{"name":3274,"slug":3275,"type":14},{"name":3277,"slug":3278,"type":14},{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14},{"slug":3285,"name":3285,"fn":3286,"description":3287,"org":3477,"tags":3478,"stars":27,"repoUrl":28,"updatedAt":3301},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3479,3480,3481,3482,3483],{"name":3268,"slug":3269,"type":14},{"name":3292,"slug":3293,"type":14},{"name":3295,"slug":3296,"type":14},{"name":9,"slug":8,"type":14},{"name":3299,"slug":3300,"type":14},{"slug":3303,"name":3303,"fn":3304,"description":3305,"org":3485,"tags":3486,"stars":27,"repoUrl":28,"updatedAt":3320},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3487,3488,3489,3490,3491,3492],{"name":3271,"slug":3272,"type":14},{"name":3310,"slug":3311,"type":14},{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14},{"name":3315,"slug":3316,"type":14},{"name":3318,"slug":3319,"type":14},{"slug":3322,"name":3322,"fn":3323,"description":3324,"org":3494,"tags":3495,"stars":27,"repoUrl":28,"updatedAt":3336},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3496,3497,3498,3499,3500],{"name":3271,"slug":3272,"type":14},{"name":3329,"slug":3330,"type":14},{"name":3332,"slug":3333,"type":14},{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14},{"slug":3338,"name":3338,"fn":3339,"description":3340,"org":3502,"tags":3503,"stars":27,"repoUrl":28,"updatedAt":3352},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3504,3505,3506,3507,3508],{"name":3344,"slug":3345,"type":14},{"name":3271,"slug":3272,"type":14},{"name":3295,"slug":3296,"type":14},{"name":9,"slug":8,"type":14},{"name":3350,"slug":3351,"type":14},{"slug":3354,"name":3354,"fn":3355,"description":3356,"org":3510,"tags":3511,"stars":27,"repoUrl":28,"updatedAt":3369},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3512,3513,3514,3515,3516,3517],{"name":3329,"slug":3330,"type":14},{"name":3361,"slug":3362,"type":14},{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14},{"name":3366,"slug":3367,"type":14},{"name":3318,"slug":3319,"type":14},{"slug":3371,"name":3371,"fn":3372,"description":3373,"org":3519,"tags":3520,"stars":27,"repoUrl":28,"updatedAt":3387},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3521,3522,3523,3524,3525],{"name":3377,"slug":3378,"type":14},{"name":3380,"slug":3381,"type":14},{"name":3383,"slug":3384,"type":14},{"name":3280,"slug":3281,"type":14},{"name":9,"slug":8,"type":14}]