websocket

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPort = 9106

DefaultPort is the default port for the WebSocket server

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

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

func NewEmitter

func NewEmitter() *Emitter

NewEmitter creates a new WebSocket emitter

func (*Emitter) Address

func (e *Emitter) Address() string

Address returns server address (for testing)

func (*Emitter) Close

func (e *Emitter) Close() error

Close shuts down the WebSocket server

func (*Emitter) Emit

func (e *Emitter) Emit(entry *entry.Entry)

Emit sends log entry to all connected clients

func (*Emitter) Init

func (e *Emitter) Init() error

Init starts WebSocket server on port 9106 or the next available port

type Message

type Message struct {
	ID   int64       `json:"id"` // Combination of timestamp and sequence number (see Emitter.sequence for details)
	Body interface{} `json:"body"`
}

Emitter implements WebSocket server that broadcasts log entries to connected clients Message represents a WebSocket message with ID

Jump to

Keyboard shortcuts

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