ws

package
v0.0.0-...-a498153 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a connected websocket client

type Hub

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

Hub manages websocket connections and fans out log messages

func NewHub

func NewHub() *Hub

NewHub creates a new websocket hub

func (*Hub) Broadcast

func (h *Hub) Broadcast(msg LogMessage)

Broadcast sends a log message to all subscribed clients

func (*Hub) Run

func (h *Hub) Run()

Run starts the hub's main event loop

func (*Hub) WSHandler

func (h *Hub) WSHandler() gin.HandlerFunc

WSHandler creates a gin handler for websocket connections

type LogMessage

type LogMessage struct {
	Timestamp  string         `json:"timestamp"`
	Service    string         `json:"service"`
	Level      string         `json:"level"`
	Message    string         `json:"message"`
	Host       string         `json:"host"`
	Attributes map[string]any `json:"attributes,omitempty"`
}

LogMessage represents a log entry sent to websocket clients

type SubscriptionFilter

type SubscriptionFilter struct {
	Hosts    []string `json:"hosts,omitempty"`
	Services []string `json:"services,omitempty"`
}

SubscriptionFilter defines what logs a client wants to receive

Jump to

Keyboard shortcuts

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