api

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const KeepaliveInterval = 4 * time.Minute

Variables

View Source
var EmbeddedFS embed.FS

The web/ go:embed directive must be in package main because we can't reference ../ here. main assigns this variable on init.

Functions

func ListenAndServe

func ListenAndServe(ctx context.Context, a *app.App, addr string) error

Types

type HTTPError

type HTTPError struct {
	StatusCode int
	// contains filtered or unexported fields
}

type Handler

type Handler struct {
	*app.App
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(app *app.App, staticContent fs.FS) *Handler

func (Handler) ConnectHandler

func (h Handler) ConnectHandler(w http.ResponseWriter, req *http.Request)

func (Handler) DisconnectHandler

func (h Handler) DisconnectHandler(w http.ResponseWriter, req *http.Request)

func (Handler) ServeHTTP

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

type JSONMessage

type JSONMessage struct {
	*fbb.Message
	// contains filtered or unexported fields
}

func (JSONMessage) MarshalJSON

func (m JSONMessage) MarshalJSON() ([]byte, error)

type WSConn

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

WSConn represent one connection in the WSHub pool

type WSHub

type WSHub struct {
	*app.App
	// contains filtered or unexported fields
}

WSHub is a hub for broadcasting data to several websocket connections

func NewWSHub

func NewWSHub(app *app.App) *WSHub

func (*WSHub) ClientAddrs

func (w *WSHub) ClientAddrs() []string

func (*WSHub) Close

func (w *WSHub) Close() error

Close closes all active WebSocket connections in the hub.

The hub should not be used after calling Close.

func (*WSHub) Handle

func (w *WSHub) Handle(conn *websocket.Conn)

Handle adds a new websocket to the hub

It will block until the client either stops responding or closes the connection.

func (*WSHub) NumClients

func (w *WSHub) NumClients() int

func (*WSHub) Prompt

func (w *WSHub) Prompt(p app.Prompt)

func (*WSHub) UpdateStatus

func (w *WSHub) UpdateStatus()

func (*WSHub) WatchMBox

func (w *WSHub) WatchMBox(ctx context.Context, mbox *mailbox.DirHandler)

func (*WSHub) WriteJSON

func (w *WSHub) WriteJSON(v interface{})

func (*WSHub) WriteNotification

func (w *WSHub) WriteNotification(n types.Notification)

func (*WSHub) WriteProgress

func (w *WSHub) WriteProgress(p types.Progress)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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