Help us shape the future of Go! Take the 2026 Go Developer Survey

ctlbridge

package
v1.3.97 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ctlbridge pkg/wasmhv/ctlbridge/ctlbridge.go c3-vis-wasm

It lets an EXTERNAL operator (curl, or `skywire cli`) drive the in-browser wasm-visor tab(s) without anyone clicking: each tab connects back over SSE (GET /ctl/events) to receive commands and POSTs results (/ctl/result) + log lines (/ctl/log). Two tabs can be orchestrated headlessly — e.g. `listen` on one and dial from the other.

The handler set is mounted by `skywire cli hv serve --harness`, so the production serving path opts into the debug surface behind a flag. The browser side is ctl-bridge.js (embedded in pkg/wasmhv as CtlBridgeJS); inject it onto the page to activate the tab.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

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

Bridge holds the live tab registry + pending-command table. Safe for concurrent use. Create with New, wire with Register.

func New

func New(logf func(string, ...interface{})) *Bridge

New returns a ready Bridge. logf is used for connection/bridge diagnostics (pass log.Printf, or nil to discard).

func (*Bridge) Register

func (b *Bridge) Register(mux *http.ServeMux)

Register mounts the /ctl/* handlers on mux.

func (*Bridge) SendCmd

func (b *Bridge) SendCmd(tabID, action string, args ...interface{}) (Result, error)

SendCmd queues one command for a tab over SSE and waits for its result. Shared by the /ctl/cmd handler and scripted sequences (e.g. meshtest).

type Command

type Command struct {
	ID     string        `json:"id"`
	Action string        `json:"action"`
	Args   []interface{} `json:"args"`
}

Command is one command queued for a tab over SSE.

type Result

type Result struct {
	ID    string      `json:"id"`
	OK    bool        `json:"ok"`
	Value interface{} `json:"value"`
	Error string      `json:"error"`
}

Result is a tab's reply to a Command.

Jump to

Keyboard shortcuts

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