playground

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type string `json:"type"`
	Data any    `json:"data,omitempty"`
}

Event is a JSON message sent over WebSocket connections.

type Hub

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

Hub manages WebSocket client connections and broadcasts events.

func NewHub

func NewHub() *Hub

NewHub creates a new Hub.

func (*Hub) Add

func (h *Hub) Add(conn *websocket.Conn, cancel context.CancelFunc)

Add registers a client connection.

func (*Hub) Broadcast

func (h *Hub) Broadcast(event Event)

Broadcast sends an event to all connected clients.

func (*Hub) Remove

func (h *Hub) Remove(conn *websocket.Conn)

Remove unregisters a client connection.

func (*Hub) Run

func (h *Hub) Run(ctx context.Context)

Run waits for context cancellation and closes all connections.

type Server

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

Server serves the playground frontend and REST/WebSocket API.

func NewServer

func NewServer(engine *testengine.Engine, logger *slog.Logger) *Server

NewServer creates a new playground Server.

func (*Server) ListenAndServe

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

ListenAndServe starts the HTTP server on the given address.

Jump to

Keyboard shortcuts

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