rpc

package
v0.76.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 8 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 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: JSON array of arguments
→ 200 with the method's JSON result (null when it only returns error)
→ 4xx/5xx with {"error": "..."} otherwise

Dispatch is reflection over explicitly registered services — the net/rpc pattern — so a new service method is exposed by registration alone. A method whose first parameter is a context.Context gets the request's, which is done when the caller hangs up; the JSON array carries the arguments after it. Token auth is applied by the transport mount, not here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

func New

func New() *Handler

func (*Handler) Deny

func (h *Handler) Deny(method string)

Deny hides one method ("store.Close") from dispatch — for methods that are public for Go callers but must not be reachable from the window.

func (*Handler) Register

func (h *Handler) Register(name string, svc any)

Register exposes every exported method of svc under name.<Method>.

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