proto

package
v0.0.0-...-b197db6 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	// NumPara
	NumParams int

	// Scope and ScopeParam indicate the scope required by the caller.
	// TODO(twiesing): Once we actually include scopes, make them dynamic
	Scope      component.Scope
	ScopeParam string

	// Handle handles this action.
	//
	// ctx is closed once the underlying connection is closed.
	// out is an io.Writer that is automatically sent to the client.
	// params holds exactly NumParams parameters.
	Handle func(ctx context.Context, in io.Reader, out io.Writer, params ...string) error
}

Action is anything that can be retrieved from a

type ActionMap

type ActionMap map[string]Action

ActionMap handles a set of WebSocket actions

func (ActionMap) Handle

func (am ActionMap) Handle(auth *auth.Auth, conn *websocketx.Connection) (name string, err error)

Handle handles a new incoming websocket connection by switching on the subprotocol. See appropriate protocol handlers for documentation.

type CallMessage

type CallMessage struct {
	Call   string   `json:"call"`
	Params []string `json:"params,omitempty"`
}

CallMessage is sent by the client to the server to invoke a remote procedure

type ResultMessage

type ResultMessage struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
}

ResultMessage is sent by the server to the client to report the success of a remote procedure

type Signal

type Signal string
const (
	SignalCancel Signal = "cancel"
)

type SignalMessage

type SignalMessage struct {
	Signal Signal `json:"signal"`
}

SignalMessage is sent from the client to the server to stop the current procedure

type WriterFunc

type WriterFunc func([]byte) (int, error)

WriterFunc implements io.Writer using a function.

func (WriterFunc) Write

func (wf WriterFunc) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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