Documentation
¶
Index ¶
- Constants
- Variables
- func ListenAndServe(ctx context.Context, a *app.App, addr string) error
- type HTTPError
- type Handler
- type JSONMessage
- type WSConn
- type WSHub
- func (w *WSHub) ClientAddrs() []string
- func (w *WSHub) Close() error
- func (w *WSHub) Handle(conn *websocket.Conn)
- func (w *WSHub) NumClients() int
- func (w *WSHub) Prompt(p app.Prompt)
- func (w *WSHub) UpdateStatus()
- func (w *WSHub) WatchMBox(ctx context.Context, mbox *mailbox.DirHandler)
- func (w *WSHub) WriteJSON(v interface{})
- func (w *WSHub) WriteNotification(n types.Notification)
- func (w *WSHub) WriteProgress(p types.Progress)
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 ¶
Types ¶
type 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)
type JSONMessage ¶
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 ¶
WSHub is a hub for broadcasting data to several websocket connections
func (*WSHub) ClientAddrs ¶
func (*WSHub) Close ¶
Close closes all active WebSocket connections in the hub.
The hub should not be used after calling Close.
func (*WSHub) Handle ¶
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 (*WSHub) UpdateStatus ¶
func (w *WSHub) UpdateStatus()
func (*WSHub) WriteNotification ¶
func (w *WSHub) WriteNotification(n types.Notification)
func (*WSHub) WriteProgress ¶
Click to show internal directories.
Click to hide internal directories.