ui

package
Version: v0.0.0-...-8b1022e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalUIDir = "../../../../../../lantern-ui/app"
)
View Source
const (
	// Determines the chunking size of messages used by gorilla
	MaxMessageSize = 1024
)

Variables

View Source
var (
	Translations *tarfs.FileSystem
)

Functions

func Handle

func Handle(p string, handler http.Handler) string

func PreferProxiedUI

func PreferProxiedUI(val bool) (newAddr string, addrChanged bool)

func Show

func Show()

Show opens the UI in a browser. Note we know the UI server is *listening* at this point as long as Start is correctly called prior to this method. It may not be reading yet, but since we're the only ones reading from those incoming sockets the fact that reading starts asynchronously is not a problem.

func Start

func Start(requestedAddr string, allowRemote bool, extUrl string) (string, error)

func Unregister

func Unregister(t string)

Types

type ConnectFunc

type ConnectFunc func(write func([]byte) error) error

type Envelope

type Envelope struct {
	EnvelopeType
	Message interface{} `json:"message"`
}

Envelope is a struct that wraps messages and associates them with a type.

type EnvelopeType

type EnvelopeType struct {
	Type string `json:"type,inline"`
}

type Service

type Service struct {
	Type string
	In   <-chan interface{}
	Out  chan<- interface{}
	// contains filtered or unexported fields
}

func Register

func Register(t string, helloFn helloFnType) (*Service, error)

type UIChannel

type UIChannel struct {
	URL string
	In  <-chan []byte
	Out chan<- []byte
	// contains filtered or unexported fields
}

UIChannel represents a data channel to/from the UI. UIChannel will have one underlying websocket connection for each connected browser window. All messages from any browser window are available via In and all messages sent to Out will be published to all browser windows.

func NewChannel

func NewChannel(p string, onConnect ConnectFunc) *UIChannel

NewChannel establishes a new channel to the UI at the given path. When the UI connects to this path, we will establish a websocket to the UI to carry messages for this UIChannel. The given onConnect function is called anytime that the UI connects.

func (*UIChannel) Close

func (c *UIChannel) Close()

Jump to

Keyboard shortcuts

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