Skip to content

Commit 8e7e0c3

Browse files
committed
Add WebSocket server impl
1 parent 03c26e4 commit 8e7e0c3

2 files changed

Lines changed: 434 additions & 1 deletion

File tree

src/server.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ import {
1414
isRequestMessage,
1515
isResponseMessage,
1616
} from "./jsonrpc.js";
17-
1817
import { serializeSseEvent, serializeSseKeepAlive } from "./sse.js";
18+
import { handleWebSocketConnection } from "./ws-server.js";
19+
import type { WebSocketServerSocket } from "./ws-server.js";
1920

2021
import type {
2122
ConnectionState,
@@ -53,6 +54,13 @@ export class AcpServer {
5354
return textResponse("Method Not Allowed", 405);
5455
}
5556

57+
handleWebSocket(socket: WebSocketServerSocket): void {
58+
handleWebSocketConnection(socket, {
59+
registry: this.registry,
60+
createAgent: this.createAgent,
61+
});
62+
}
63+
5664
async close(): Promise<void> {
5765
this.registry.closeAll();
5866
}

0 commit comments

Comments
 (0)