server

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port       int
	Theme      string
	Content    string
	Filename   string
	IsMarkdown bool
	Verbose    bool
	Label      string // display name for window badge
	ColorHex   string // hex color for window badge (e.g. "#FF453A")
}

Config holds server configuration.

type Server

type Server struct {
	OnShutdown func() // called before server shutdown (e.g. to terminate webview)
	// contains filtered or unexported fields
}

Server is the HTTP server for mmdp.

func New

func New(cfg Config) *Server

New creates a new Server.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the listener address, or empty string if not started.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown initiates graceful shutdown.

func (*Server) Start

func (s *Server) Start(ctx context.Context) (string, error)

Start starts the HTTP server and returns the listening address.

func (*Server) UpdateContent

func (s *Server) UpdateContent(content string, blocks []string)

UpdateContent updates the diagram content and broadcasts to WebSocket clients.

func (*Server) Wait

func (s *Server) Wait()

Wait blocks until the server has shut down.

type WSHub

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

WSHub manages WebSocket connections using a simple mutex + slice pattern.

Jump to

Keyboard shortcuts

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