RPC Handlers
RPC handlers are functions that process incoming JSON-RPC requests. The server usescreateRpcRouter to dispatch requests to the correct handler based on the method name.
Defining a handler
UsedefineMethod for type-safe handler definitions:
Handler context
Every handler receives anAuthenticatedContext:
Creating the router
-32602 InvalidParams automatically.
Handler groups
The example server organizes handlers into groups by domain:createCoreAuthHandlers()— auth/connect, auth/register, agents/*createConversationHandlers()— conversations/*createMessageHandlers()— messages/*createPresenceHandlers()— presence/, typing/