server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LiveReloadScript

func LiveReloadScript() string

LiveReloadScript returns the JavaScript code for live reload

Types

type LiveReload

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

LiveReload manages WebSocket connections for live reload functionality

func NewLiveReload

func NewLiveReload() *LiveReload

NewLiveReload creates a new live reload manager

func (*LiveReload) Close

func (lr *LiveReload) Close()

Close closes all connections and stops the broadcast loop

func (*LiveReload) ConnectionCount

func (lr *LiveReload) ConnectionCount() int

ConnectionCount returns the number of active connections

func (*LiveReload) HandleWebSocket

func (lr *LiveReload) HandleWebSocket(w http.ResponseWriter, r *http.Request)

HandleWebSocket handles WebSocket upgrade and connection

func (*LiveReload) NotifyReload

func (lr *LiveReload) NotifyReload()

NotifyReload signals all connected clients to reload

func (*LiveReload) Start

func (lr *LiveReload) Start(ctx context.Context)

Start begins the broadcast loop

type RenderFunc

type RenderFunc func(ctx context.Context, s *site.Site) error

RenderFunc is a function that renders all pages for a site Users provide this to use their own components

type Server

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

Server represents the development server

func New

func New(s *site.Site, addr string, renderFunc RenderFunc) (*Server, error)

New creates a new development server

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve starts the development server

Jump to

Keyboard shortcuts

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