rpc

package
v0.93.0-rc.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rpc exposes the app's Go services to the window, `lich` and `lich mcp` over plain HTTP on the local transport listener: the window is its own process and never imports internal/ (docs/native-window.md). One POST per call:

POST /rpc/<service>.<Method>?token=...   body: [options] or []
→ 200 with the method's JSON result (null when it only returns error)
→ 4xx/5xx with {"error": "..."} otherwise

Only a method declared in api and exposed with Handle answers; the compiler holds the handler to the method's options and result types. Its context is done when the caller hangs up. Token auth is applied by the transport mount, not here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle added in v0.78.1

func Handle[Req, Resp any](h *Handler, m api.Method[Req, Resp], fn func(context.Context, Req) (Resp, error))

Handle exposes fn as m.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New() *Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles one call.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL