Skip to content

Commit 093eef4

Browse files
committed
chore(example-raw-websocket-handler-proxy): use correct url and mount registry
1 parent 91a7caa commit 093eef4

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

examples/raw-websocket-handler-proxy/src/backend/server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { createNodeWebSocket } from "@hono/node-ws";
33
import { Hono } from "hono";
44
import { registry } from "./registry.js";
55

6-
const { client } = registry.createServer();
6+
const { client, hono } = registry.createServer({
7+
getUpgradeWebSocket: () => upgradeWebSocket,
8+
});
79

810
const app = new Hono();
911
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app });
@@ -45,5 +47,8 @@ app.get(
4547
}),
4648
);
4749

50+
// Mount RivetKit's registry (optional, but required for Studio integration)
51+
app.route("/registry", hono);
52+
4853
const server = serve({ port: 8080, fetch: app.fetch });
4954
injectWebSocket(server);

examples/raw-websocket-handler-proxy/src/frontend/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function App() {
1616
`conn_params.${encodeURIComponent(JSON.stringify({ apiKey: "your-api-key" }))}`
1717
];
1818

19-
const ws = new WebSocket("ws://localhost:8080/registry/actors/chatRoom/ws/", protocols);
19+
const ws = new WebSocket("ws://localhost:8080/registry/actors/raw/websocket/", protocols);
2020

2121
ws.onopen = () => {
2222
setIsConnected(true);

examples/raw-websocket-handler-proxy/tests/basic.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ describe("basic websocket test", () => {
2727

2828
expect(initMessage.type).toBe("init");
2929
expect(initMessage.messages).toEqual([]);
30-
expect(initMessage.users).toBeDefined();
3130

3231
// Send a message
3332
ws.send(JSON.stringify({ type: "message", text: "Hello!" }));

packages/core/src/test/mod.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ import { type TestContext, vi } from "vitest";
55
import { type Client, createClient } from "@/client/mod";
66
import { createFileSystemOrMemoryDriver } from "@/drivers/file-system/mod";
77
import { createInlineClientDriver } from "@/inline-client-driver/mod";
8-
import { getStudioUrl } from "@/inspector/utils";
98
import { createManagerRouter } from "@/manager/router";
109
import type { Registry } from "@/registry/mod";
11-
import { RunConfigSchema } from "@/registry/run-config";
1210
import { ConfigSchema, type InputConfig } from "./config";
1311
import { logger } from "./log";
1412

@@ -27,12 +25,11 @@ function serve(registry: Registry<any>, inputConfig?: InputConfig): ServerType {
2725
}
2826

2927
// Create router
30-
const runConfig = RunConfigSchema.parse(inputConfig);
3128
const managerDriver = config.driver.manager(registry.config, config);
3229
const inlineClientDriver = createInlineClientDriver(managerDriver);
3330
const { router } = createManagerRouter(
3431
registry.config,
35-
runConfig,
32+
config,
3633
inlineClientDriver,
3734
managerDriver,
3835
);

0 commit comments

Comments
 (0)