emitter

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleware

func NewMiddleware(remote string, next http.Handler) http.Handler

NewMiddleware creates an HTTP handler that acts as middleware. Its primary purpose is to intercept HTTP responses and inject a WebSocket client script into the body of HTML pages. This injection allows for dynamic content updates on the client side without requiring a page refresh.

Types

type Emitter

type Emitter interface {
	Emit(evt events.Event)
}

type EventJSON

type EventJSON struct {
	Type events.Type `json:"type"`
	Data any         `json:"data"`
}

type NoopServer

type NoopServer struct{}

func (*NoopServer) Emit

func (*NoopServer) Emit(evt events.Event)

type Server

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

func NewServer

func NewServer(logger *slog.Logger) *Server

func (*Server) Emit

func (s *Server) Emit(evt events.Event)

func (*Server) ServeHTTP

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

ws handler

Jump to

Keyboard shortcuts

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