ios

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DocumentScheme is the custom WKURLSchemeHandler scheme used by the iOS host.
	DocumentScheme = "vango"
	// QuerySceneID scopes WebSocket upgrades to a native iOS scene.
	QuerySceneID = "vango_scene"
	// QueryRuntimeToken authenticates embedded loopback WebSocket upgrades.
	QueryRuntimeToken = "vango_rt"
)

Variables

This section is empty.

Functions

func DefaultCapabilities

func DefaultCapabilities() shell.CapabilitySet

DefaultCapabilities returns the reference capability set for the iOS host.

Types

type ClientMessage

type ClientMessage struct {
	Type    string          `json:"type"`
	Payload json.RawMessage `json:"payload,omitempty"`
}

ClientMessage is sent from the embedded WebView back into the iOS runtime.

type HTTPResponse

type HTTPResponse struct {
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers,omitempty"`
	Cookies []string          `json:"cookies,omitempty"`
	Body    []byte            `json:"body,omitempty"`
}

HTTPResponse is the in-memory response shape returned to the WKURLSchemeHandler.

type Host

type Host interface {
	Dispatch(sceneID string, cmd shell.Command) error
	Request(ctx context.Context, sceneID string, req shell.Request) (shell.Response, error)
}

Host executes normalized shell commands and requests against the native host.

type Options

type Options struct {
	BundleID              string
	AppVersion            string
	BuildChannel          string
	ApplicationSupportDir string
	CacheDir              string
	LogDir                string
	SessionStorePath      string
	RuntimeTokenTTL       time.Duration
	Capabilities          shell.CapabilitySet
	Logger                *slog.Logger
}

Options configure the iOS mobile runtime.

type ResumeEntry

type ResumeEntry struct {
	Key       string    `json:"key,omitempty"`
	SessionID string    `json:"sessionID,omitempty"`
	LastSeq   uint64    `json:"lastSeq,omitempty"`
	LastPath  string    `json:"lastPath,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

ResumeEntry stores scene-scoped resumable session metadata.

type Runtime

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

Runtime hosts a Vango app inside a native iOS shell.

func New

func New(app *vango.App, host Host, opts Options) (*Runtime, error)

New creates an iOS mobile runtime for the given Vango app.

func (*Runtime) BaseURL

func (r *Runtime) BaseURL() string

BaseURL returns the loopback server base URL used by the native host proxy.

func (*Runtime) CloseScene

func (r *Runtime) CloseScene(sceneID string) error

CloseScene removes the scene registration and preserves its current route.

func (*Runtime) EmitShellEvent

func (r *Runtime) EmitShellEvent(sceneID string, event shell.Event) error

EmitShellEvent publishes a host-originated shell event to the target scene.

func (*Runtime) HandleClientMessage

func (r *Runtime) HandleClientMessage(sceneID string, raw []byte) error

HandleClientMessage applies a client-originated host bridge message.

func (*Runtime) HandleRequest

func (r *Runtime) HandleRequest(sceneID, method, path string, headers map[string]string, body []byte) (HTTPResponse, error)

HandleRequest serves a scene-scoped in-memory HTTP request for the custom URL scheme handler.

func (*Runtime) PrepareScene

func (r *Runtime) PrepareScene(sceneID, path string) (SceneLaunch, error)

PrepareScene registers a scene and returns the document URL plus native WebSocket URL.

func (*Runtime) Shutdown

func (r *Runtime) Shutdown(ctx context.Context) error

Shutdown stops the loopback WebSocket server.

func (*Runtime) Start

func (r *Runtime) Start() error

Start launches the loopback WebSocket server if it is not already running.

type SceneLaunch

type SceneLaunch struct {
	SceneID      string `json:"sceneID"`
	URL          string `json:"url"`
	WebSocketURL string `json:"webSocketURL"`
}

SceneLaunch describes how the native host should bootstrap a scene.

type StoragePaths

type StoragePaths struct {
	ApplicationSupportDir string
	CacheDir              string
	LogDir                string
	SessionStorePath      string
}

StoragePaths holds the stable filesystem locations used by the iOS runtime.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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