Universal DevTools Kit SDK / @u-devtools/core / RpcServerInterface
Interface: RpcServerInterface
Defined in: index.ts:559
RPC Server Interface - Interface for handling RPC requests from clients. Used in server-side plugin setup to register method handlers.
Example
ts
export function setupServer(rpc: RpcServerInterface, ctx: ServerContext) {
rpc.handle('my-plugin:getData', async (payload) => {
// Handle RPC call
return { data: 'result' };
});
rpc.broadcast('my-plugin:update', { data: 'new' });
}Methods
broadcast()
broadcast(
event,payload?):void
Defined in: index.ts:572
Broadcast an event to all connected clients.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | string | Event name |
payload? | unknown | Optional event data |
Returns
void
handle()
handle(
method,fn):void
Defined in: index.ts:565
Register a handler for an RPC method.
Parameters
| Parameter | Type | Description |
|---|---|---|
method | string | Method name (e.g., 'my-plugin:getData') |
fn | (payload) => unknown | Handler function that receives payload and returns result |
Returns
void