web

package
v0.2.22 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: AGPL-3.0 Imports: 51 Imported by: 13

Documentation

Overview

Package web provides gRPC/REST/GUI APIs to control and monitor a robot.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunWeb

func RunWeb(ctx context.Context, r robot.LocalRobot, o weboptions.Options, logger golog.Logger) (err error)

RunWeb starts the web server on the robot with web options and blocks until we cancel the context.

func RunWebWithConfig

func RunWebWithConfig(ctx context.Context, r robot.LocalRobot, cfg *config.Config, logger golog.Logger) error

RunWebWithConfig starts the web server on the robot with a robot config and blocks until we cancel the context.

Types

type AppTemplateData added in v0.2.2

type AppTemplateData struct {
	External                   bool                     `json:"external"`
	WebRTCEnabled              bool                     `json:"webrtc_enabled"`
	WebRTCSignalingAddress     string                   `json:"webrtc_signaling_address"`
	WebRTCAdditionalICEServers []map[string]interface{} `json:"webrtc_additional_ice_servers"`
	Env                        string                   `json:"env"`
	Host                       string                   `json:"host"`
	SupportedAuthTypes         []string                 `json:"supported_auth_types"`
	AuthEntity                 string                   `json:"auth_entity"`
	BakedAuth                  map[string]interface{}   `json:"baked_auth"`
}

AppTemplateData is used to render the remote control page.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures how we set up the web service. Cribbed from https://github.com/grpc/grpc-go/blob/aff571cc86e6e7e740130dbbb32a9741558db805/dialoptions.go#L41

func WithStreamConfig

func WithStreamConfig(config gostream.StreamConfig) Option

WithStreamConfig returns an Option which sets the streamConfig used to enable audio/video streaming over WebRTC.

type Service

type Service interface {
	// Start starts the web server
	Start(context.Context, weboptions.Options) error

	// Stop stops the main web service (but leaves module server socket running.)
	Stop()

	// StartModule starts the module server socket.
	StartModule(context.Context) error

	// Returns the address and port the web service listens on.
	Address() string

	// Returns the unix socket path the module server listens on.
	ModuleAddress() string

	// Close closes the web server
	Close() error
}

A Service controls the web server for a robot.

func New

func New(ctx context.Context, r robot.Robot, logger golog.Logger, opts ...Option) Service

New returns a new web service for the given robot.

type StreamServer

type StreamServer struct {
	// Server serves streams
	Server gostream.StreamServer
	// HasStreams is true if service has streams that require a WebRTC connection.
	HasStreams bool
}

StreamServer manages streams and displays.

Directories

Path Synopsis
Package weboptions provides Options for configuring a web server
Package weboptions provides Options for configuring a web server
Package webstream provides controls for streaming from the web server.
Package webstream provides controls for streaming from the web server.

Jump to

Keyboard shortcuts

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