wave

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

README

H2O Wave

Wave logo

PyPI - Downloads License PyPI Twitter Follow discord chat Contributor covenant

Realtime Web Apps and Dashboards for Python and R

New! R Language API Build and control Wave dashboards using R!

H2O Wave is a software stack for building beautiful, low-latency, realtime, browser-based applications and dashboards entirely in Python/R without using HTML, Javascript, or CSS.

H2O Wave excels at capturing information from multiple sources and broadcasting them live over the web, letting you build and deploy realtime analytics with dramatically less effort.

Live demos

Responsive Layouts

Dashboard

Dashboard

Dashboard

Dashboard

Dashboard

Dashboard

Dashboard

Code: https://github.com/h2oai/wave/tree/main/py/demo

Themes

Light Theme

Neon Theme

(Coming soon!)

Dark Theme

80+ components, 250+ examples

More at https://wave.h2o.ai/docs/examples

Components

Visualizations

License

H2O Wave is licensed under the Apache License 2.0. See LICENSE for more information.

Documentation

Index

Constants

View Source
const (

	// TODO: Refactor into iota.
	STATE_CREATED    = "CREATED"
	STATE_TIMEOUT    = "TIMEOUT"
	STATE_LISTEN     = "LISTEN"
	STATE_RECONNECT  = "RECONNECT"
	STATE_DISCONNECT = "DISCONNECT"
	STATE_CLOSED     = "CLOSED"
)
View Source
const (
	BYTE = 1 << (10 * iota)
	KILOBYTE
	MEGABYTE
	GIGABYTE
	TERABYTE
	PETABYTE
	EXABYTE
)

Variables

This section is empty.

Functions

func CompactSite added in v0.14.0

func CompactSite(aofPath string)

func ParseBytes added in v0.14.0

func ParseBytes(s string) (uint64, error)

ParseBytes parses string representations (e.g. 42K or 42KB or 42KiB) to bytes

func Run

func Run(conf ServerConf)

Run runs the HTTP server.

Types

type App

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

App represents an app

type AppMode

type AppMode int

AppMode represents app modes.

type AppRequest

type AppRequest struct {
	RegisterApp   *RegisterApp   `json:"register_app,omitempty"`
	UnregisterApp *UnregisterApp `json:"unregister_app,omitempty"`
}

AppRequest represents a request from an app.

type Auth added in v0.14.0

type Auth struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Auth holds authenticated end-user sessions

type AuthConf added in v0.14.0

type AuthConf struct {
	ClientID              string
	ClientSecret          string
	ProviderURL           string
	RedirectURL           string
	EndSessionURL         string
	PostLogoutRedirectURL string
	Scopes                []string
	URLParameters         [][]string
	SkipLogin             bool
	SessionExpiry         time.Duration
	InactivityTimeout     time.Duration
}

type AuthHandler added in v0.14.0

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

AuthHandler handles OAuth2 requests

func (*AuthHandler) ServeHTTP added in v0.14.0

func (h *AuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type BootMsg added in v0.25.3

type BootMsg struct {
	Data struct {
		Hash           string `json:"#,omitempty"`                        // location hash
		SubmissionName string `json:"__wave_submission_name__,omitempty"` // mark the cause of the serve invocation
	} `json:"data"`
	Headers http.Header `json:"headers"` // forwarded headers
}

BootMsg represents the initial message sent to an app when a client first connects to it.

type Broker

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

Broker represents a message broker.

type Buf

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

Buf represents a generic dictionary-like buffer.

type BufD

type BufD struct {
	C *CycBufD  `json:"c,omitempty"`
	F *FixBufD  `json:"f,omitempty"`
	M *MapBufD  `json:"m,omitempty"`
	L *ListBufD `json:"l,omitempty"`
}

BufD represents the marshaled data for a buffer. This is a discriminated union.

type BufEntry added in v1.0.0

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

Tmp placeholder for key-buffer pairs.

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cache represents a collection of shards.

func (*Cache) ServeHTTP

func (c *Cache) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Card

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

Card represents an item on a Page, and holds attributes and data for rendering views.

type CardD

type CardD struct {
	D map[string]interface{} `json:"d"`           // data
	B []BufD                 `json:"b,omitempty"` // buffers
}

CardD represents the marshaled data for a Card.

type Client

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

Client represent a websocket (UI) client.

type Conf added in v0.26.0

type Conf struct {
	Version               bool   `cfg:"version" env:"H2O_WAVE_VERSION" cfgDefault:"false"`
	Listen                string `cfg:"listen" env:"H2O_WAVE_LISTEN" cfgDefault:":10101" cfgHelper:"listen on this address"`
	BaseUrl               string `` /* 175-byte string literal not displayed */
	WebDir                string `cfg:"web-dir" env:"H2O_WAVE_WEB_DIR" cfgDefault:"./www" cfgHelper:"directory to serve web assets from, hosted at /"`
	DataDir               string `cfg:"data-dir" env:"H2O_WAVE_DATA_DIR" cfgDefault:"./data" cfgHelper:"directory to store site data"`
	PublicDirs            string `` /* 296-byte string literal not displayed */
	PrivateDirs           string `` /* 325-byte string literal not displayed */
	AccessKeyID           string `cfg:"access-key-id" env:"H2O_WAVE_ACCESS_KEY_ID" cfgDefault:"access_key_id" cfgHelper:"default API access key ID"`
	AccessKeySecret       string `` /* 129-byte string literal not displayed */
	AccessKeyFile         string `` /* 132-byte string literal not displayed */
	CreateAccessKey       bool   `` /* 160-byte string literal not displayed */
	ListAccessKeys        bool   `` /* 129-byte string literal not displayed */
	RemoveAccessKeyID     string `` /* 139-byte string literal not displayed */
	Init                  string `cfg:"init" env:"H2O_WAVE_INIT" cfgDefault:"" cfgHelper:"initialize site content from AOF log"`
	Compact               string `cfg:"compact" env:"H2O_WAVE_COMPACT" cfgDefault:"" cfgHelper:"compact AOF log"`
	CertFile              string `cfg:"tls-cert-file" env:"H2O_WAVE_TLS_CERT_FILE" cfgDefault:"" cfgHelper:"path to certificate file (TLS only)"`
	KeyFile               string `cfg:"tls-key-file" env:"H2O_WAVE_TLS_KEY_FILE" cfgDefault:"" cfgHelper:"path to private key file (TLS only)"`
	SkipCertVerification  bool   `` /* 167-byte string literal not displayed */
	HttpHeadersFile       string `` /* 183-byte string literal not displayed */
	ForwardedHttpHeaders  string `` /* 323-byte string literal not displayed */
	Editable              bool   `cfg:"editable" env:"H2O_WAVE_EDITABLE" cfgDefault:"false" cfgHelper:"allow users to edit web pages"`
	MaxRequestSize        string `` /* 159-byte string literal not displayed */
	MaxCacheRequestSize   string `` /* 177-byte string literal not displayed */
	Proxy                 bool   `` /* 169-byte string literal not displayed */
	MaxProxyRequestSize   string `` /* 165-byte string literal not displayed */
	MaxProxyResponseSize  string `` /* 168-byte string literal not displayed */
	SessionExpiry         string `` /* 141-byte string literal not displayed */
	InactivityTimeout     string `` /* 167-byte string literal not displayed */
	PingInterval          string `` /* 194-byte string literal not displayed */
	NoStore               bool   `` /* 138-byte string literal not displayed */
	NoLog                 bool   `` /* 155-byte string literal not displayed */
	Debug                 bool   `cfg:"debug" env:"H2O_WAVE_DEBUG" cfgDefault:"false" cfgHelper:"enable debug mode (profiling, inspection, etc.)"`
	ClientID              string `cfg:"oidc-client-id" env:"H2O_WAVE_OIDC_CLIENT_ID" cfgDefault:"" cfgHelper:"OIDC client ID"`
	ClientSecret          string `cfg:"oidc-client-secret" env:"H2O_WAVE_OIDC_CLIENT_SECRET" cfgDefault:"" cfgHelper:"OIDC client secret"`
	ProviderUrl           string `cfg:"oidc-provider-url" env:"H2O_WAVE_OIDC_PROVIDER_URL" cfgDefault:"" cfgHelper:"OIDC provider URL"`
	RedirectUrl           string `cfg:"oidc-redirect-url" env:"H2O_WAVE_OIDC_REDIRECT_URL" cfgDefault:"" cfgHelper:"OIDC redirect URL"`
	EndSessionUrl         string `cfg:"oidc-end-session-url" env:"H2O_WAVE_OIDC_END_SESSION_URL" cfgDefault:"" cfgHelper:"OIDC end session URL"`
	PostLogoutRedirectUrl string `` /* 136-byte string literal not displayed */
	RawAuthScopes         string `` /* 142-byte string literal not displayed */
	RawAuthURLParams      string `` /* 219-byte string literal not displayed */
	SkipLogin             bool   `` /* 139-byte string literal not displayed */
	KeepAppLive           bool   `cfg:"keep-app-live" env:"H2O_WAVE_KEEP_APP_LIVE" cfgDefault:"false" cfgHelper:"do not unregister unresponsive apps"`
	Conf                  string `cfg:"conf" env:"H2O_WAVE_CONF" cfgDefault:".env" cfgHelper:"path to configuration file"`
	ReconnectTimeout      string `` /* 138-byte string literal not displayed */
	AllowedOrigins        string `` /* 163-byte string literal not displayed */
}

type Cur

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

Cur represents a type-aware cursor for accessing fields in a tuple.

type CycBuf

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

CycBuf represents a cyclic buffer.

type CycBufD

type CycBufD struct {
	F []string        `json:"f"` // fields
	D [][]interface{} `json:"d"` // tuples
	N int             `json:"n"` // size
	I int             `json:"i"` // index
}

CycBufD represents the marshaled data for a CycBuf.

type DebugHandler

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

DebugHandler is a HTTP handler for site profiling.

func (*DebugHandler) ServeHTTP

func (h *DebugHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type DirServer added in v0.18.0

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

DirServer represents a file server for arbitrary directories.

func (*DirServer) ServeHTTP added in v0.18.0

func (ds *DirServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type FileServer

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

FileServer represents a file server.

func (*FileServer) ServeHTTP

func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type FixBuf

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

FixBuf represents a fixed-sized buffer.

type FixBufD

type FixBufD struct {
	F []string        `json:"f"` // fields
	D [][]interface{} `json:"d"` // tuples
	N int             `json:"n"` // size
}

FixBufD represents the marshaled data for a FixBuf.

type ListBuf added in v0.26.0

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

ListBuf represents a list (dynamic array) buffer.

type ListBufD added in v0.26.0

type ListBufD struct {
	F []string        `json:"f"` // fields
	D [][]interface{} `json:"d"` // tuples
	N int             `json:"n"` // size
}

type Log

type Log map[string]string

Log represents key-value data for a log message.

type LoginHandler added in v0.14.0

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

LoginHandler handles auth requests

func (*LoginHandler) ServeHTTP added in v0.14.0

func (h *LoginHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LogoutHandler added in v0.14.0

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

LogoutHandler handles logout requests

func (*LogoutHandler) ServeHTTP added in v0.14.0

func (h *LogoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type MapBuf

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

MapBuf represents a map (dictionary) buffer.

type MapBufD

type MapBufD struct {
	F []string                 `json:"f"` // fields
	D map[string][]interface{} `json:"d"` // tuples
}

MapBufD represents the marshaled data for a MapBuf.

type Meta added in v0.13.0

type Meta struct {
	Username string `json:"u"` // active user's username
	Editor   bool   `json:"e"` // can the user edit pages?
}

Meta represents metadata unrelated to commands

type Msg

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

Msg represents a message.

type MsgT

type MsgT int

MsgT represents message types.

type MultipartFrame added in v0.18.0

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

MultipartFrame represents a single frame in a multipart stream.

type MultipartServer added in v0.18.0

type MultipartServer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MultipartServer handles multipart/x-mixed-replace content.

func (*MultipartServer) ServeHTTP added in v0.18.0

func (s *MultipartServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type MultipartSource added in v0.18.0

type MultipartSource struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MultipartSource represents a source of multipart data.

type Namespace

type Namespace struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Namespace is a cache of all known data types in use.

type OpD

type OpD struct {
	K string                 `json:"k,omitempty"` // key; ""=drop page
	V interface{}            `json:"v,omitempty"` // value
	C *CycBufD               `json:"c,omitempty"` // value
	F *FixBufD               `json:"f,omitempty"` // value
	M *MapBufD               `json:"m,omitempty"` // value
	L *ListBufD              `json:"l,omitempty"` // value
	D map[string]interface{} `json:"d,omitempty"` // card data
	B []BufD                 `json:"b,omitempty"` // card buffers
}

OpD represents a delta operation (effector) Discriminated union; valid combos: K, set:KV|KC|KF|KM, put:KD|KDB

type OpsD

type OpsD struct {
	P *PageD `json:"p,omitempty"` // page
	D []OpD  `json:"d,omitempty"` // deltas
	R int    `json:"r,omitempty"` // reset
	U string `json:"u,omitempty"` // redirect
	E string `json:"e,omitempty"` // error
	M *Meta  `json:"m,omitempty"` // metadata
	C int    `json:"c,omitempty"` // clear UI state
	I string `json:"i,omitempty"` // client id
}

OpsD represents the set of changes to be applied to a Page. This is a discriminated union.

type Page

type Page struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Page represents a web page.

type PageD

type PageD struct {
	C map[string]CardD `json:"c"` // cards
}

PageD represents the marshaled data for a Page.

type Proxy

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

Proxy represents a HTTP proxy

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProxyRequest

type ProxyRequest struct {
	Method  string              `json:"method"`
	URL     string              `json:"url"`
	Headers map[string][]string `json:"headers"`
	Body    string              `json:"body"`
}

ProxyRequest represents the request to be sent to the upstream server.

type ProxyResponse

type ProxyResponse struct {
	Status  string              `json:"status"`
	Code    int                 `json:"code"`
	Headers map[string][]string `json:"headers"`
	Body    string              `json:"body"`
}

ProxyResponse represents the response received from the upstream server.

type ProxyResult

type ProxyResult struct {
	Error  string         `json:"error"`
	Result *ProxyResponse `json:"result"`
}

ProxyResult represents the result returned for a proxy request.

type Pub

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

Pub represents a published message

type RefreshHandler added in v0.23.0

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

Handles token refreshes.

func (*RefreshHandler) ServeHTTP added in v0.23.0

func (h *RefreshHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RegisterApp

type RegisterApp struct {
	Mode      string `json:"mode"`
	Route     string `json:"route"`
	Address   string `json:"address"`
	KeyID     string `json:"key_id"`
	KeySecret string `json:"key_secret"`
}

RegisterApp represents a request to register an app.

type ServerConf

type ServerConf struct {
	Version              string
	BuildDate            string
	Listen               string
	BaseURL              string
	WebDir               string
	DataDir              string
	PublicDirs           []string
	PrivateDirs          []string
	Keychain             *keychain.Keychain
	Init                 string
	Compact              string
	CertFile             string
	SkipCertVerification bool
	KeyFile              string
	Header               http.Header
	Editable             bool
	MaxRequestSize       int64
	MaxCacheRequestSize  int64
	Proxy                bool
	MaxProxyRequestSize  int64
	MaxProxyResponseSize int64
	NoStore              bool
	NoLog                bool
	IDE                  bool
	Debug                bool
	Auth                 *AuthConf
	ForwardedHeaders     map[string]bool
	KeepAppLive          bool
	PingInterval         time.Duration
	ReconnectTimeout     time.Duration
	AllowedOrigins       map[string]bool
}

ServerConf represents Server configuration options.

type Session added in v0.14.0

type Session struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Session represents an end-user session

type Shard

type Shard struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Shard represents a collection of key-value pairs.

type Site

type Site struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Site represents the website, and holds a collection of pages.

type SocketServer

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

SocketServer represents a websocket server.

func (*SocketServer) ServeHTTP

func (s *SocketServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Sub

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

Sub represents a subscription.

type Typ

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

Typ represents a data type.

type UnregisterApp

type UnregisterApp struct {
	Route string `json:"route"`
}

UnregisterApp represents a request to unregister an app.

type UploadResponse

type UploadResponse struct {
	Files []string `json:"files"`
}

UploadResponse represents a response to a file upload operation.

type WebServer

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

WebServer represents a web server (d'oh).

func (*WebServer) ServeHTTP

func (s *WebServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
cmd
fs
pkg
db

Jump to

Keyboard shortcuts

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