events

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventManager

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

EventManager manages WebSocket connections and broadcasting of messages.

func NewEventManager

func NewEventManager() *EventManager

NewEventManager creates a new EventManager instance.

func (*EventManager) Broadcast

func (em *EventManager) Broadcast(endpoint string, message []byte)

Broadcast sends a message to all clients at the specified endpoint.

func (*EventManager) BroadcastToAll

func (em *EventManager) BroadcastToAll(message []byte)

BroadcastToAll sends a message to all clients across all endpoints.

func (*EventManager) HandleConnection

func (em *EventManager) HandleConnection(conn *websocket.Conn, endpoint string)

HandleConnection adds a WebSocket connection to the specified endpoint.

func (*EventManager) UpgradeConnection

func (em *EventManager) UpgradeConnection(w http.ResponseWriter, r *http.Request) (*websocket.Conn, error)

UpgradeConnection upgrades an HTTP request to a WebSocket connection.

Jump to

Keyboard shortcuts

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