Skip to main content
@ade-dev/sdk/server exports createAdeServer() and createAdeRemoteClient(). The SDK handles the chat RPC contract; your app owns the WebSocket listener, authentication and network policy.
The server does not bind a port or load a WebSocket package. handleConnection() accepts a browser WebSocket or Node ws socket. Closing the bridge removes its listeners and per-connection thread handles; the host still owns and disposes the client. authorize runs before every built-in, custom or unsupported RPC. allowThreadKey runs on each thread-key call and can filter threads.list(). A connection can only use a thread after calling threads.open through that connection. openOptions(key, rendererOptions, context) lets the host add trusted options or constrain what a renderer may choose. You can add host-owned RPCs through methods. They use the same authorization check:
The protocol is JSON over WebSocket:
Errors use { "id", "ok": false, "error": { "code", "message" } }. The server sends thread events and provider/client changes as pushes. createAdeRemoteClient(url) returns the remote client; pass { WebSocket } if the environment has no global WebSocket. A compatible transport object can be passed instead of a URL.
The remote client implements the chat-ui SDK adapter surface and also exposes call(method, params) for host-defined methods. Its thread.usage() is asynchronous because it makes an RPC. Use wss:// for remote networks and authenticate before accepting a connection; the SDK does not add TLS or user authentication.