Elysia WebSocket client adapter for kkrpc
This adapter provides WebSocket client functionality for connecting to Elysia WebSocket servers. It uses the standard WebSocket API to connect to Elysia WebSocket endpoints.
import { ElysiaWebSocketClientIO, RPCChannel } from 'kkrpc'const io = new ElysiaWebSocketClientIO('ws://localhost:3000/rpc')const rpc = new RPCChannel(io, { expose: { getName: () => 'Client' }})const api = rpc.getAPI<{ greet: (name: string) => Promise<string>}>()console.log(await api.greet('World')) // "Hello, World!" Copy
import { ElysiaWebSocketClientIO, RPCChannel } from 'kkrpc'const io = new ElysiaWebSocketClientIO('ws://localhost:3000/rpc')const rpc = new RPCChannel(io, { expose: { getName: () => 'Client' }})const api = rpc.getAPI<{ greet: (name: string) => Promise<string>}>()console.log(await api.greet('World')) // "Hello, World!"
Optional
Clean up resources used by the IO adapter
Signal that the IO adapter should prepare for destruction
Elysia WebSocket client adapter for kkrpc
This adapter provides WebSocket client functionality for connecting to Elysia WebSocket servers. It uses the standard WebSocket API to connect to Elysia WebSocket endpoints.
Example