websocket

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

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

DataStore stores server data

func NewDataStore

func NewDataStore() *DataStore

NewDataStore creates a new data store

func (*DataStore) Get

func (ds *DataStore) Get(key string) (interface{}, bool)

Get retrieves data

func (*DataStore) GetDrifts

func (ds *DataStore) GetDrifts() []interface{}

GetDrifts retrieves drifts

func (*DataStore) GetResourceCount

func (ds *DataStore) GetResourceCount() int

GetResourceCount retrieves resource count

func (*DataStore) Set

func (ds *DataStore) Set(key string, value interface{})

Set stores data

func (*DataStore) SetCredentialStatus

func (ds *DataStore) SetCredentialStatus(status interface{})

SetCredentialStatus stores credential status

type EnhancedDashboardServer

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

EnhancedDashboardServer represents the WebSocket server

func NewServer

func NewServer() *EnhancedDashboardServer

NewServer creates a new WebSocket server

func (*EnhancedDashboardServer) BroadcastDiscoveryUpdate

func (s *EnhancedDashboardServer) BroadcastDiscoveryUpdate(provider string, progress int, message string)

BroadcastDiscoveryUpdate broadcasts discovery updates

func (*EnhancedDashboardServer) BroadcastDriftDetected

func (s *EnhancedDashboardServer) BroadcastDriftDetected(driftCount int, severity string)

BroadcastDriftDetected broadcasts drift detection events

func (*EnhancedDashboardServer) BroadcastRemediationUpdate

func (s *EnhancedDashboardServer) BroadcastRemediationUpdate(planID string, status string, progress int)

BroadcastRemediationUpdate broadcasts remediation updates

func (*EnhancedDashboardServer) BroadcastResourceChange

func (s *EnhancedDashboardServer) BroadcastResourceChange(changeType string, resourceID string, provider string)

BroadcastResourceChange broadcasts resource changes

func (*EnhancedDashboardServer) Run

func (s *EnhancedDashboardServer) Run()

Run starts the WebSocket server broadcast processing

func (*EnhancedDashboardServer) SetAPIServer

func (s *EnhancedDashboardServer) SetAPIServer(apiServer ServerMetricsInterface)

SetAPIServer sets the API server reference for metrics tracking

type EventBridge

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

EventBridge connects the event bus to WebSocket clients

func NewEventBridge

func NewEventBridge(eventBus *events.EventBus, wsServer *EnhancedDashboardServer) *EventBridge

NewEventBridge creates a new event bridge

func (*EventBridge) BroadcastCustomMessage

func (eb *EventBridge) BroadcastCustomMessage(messageType string, data interface{})

BroadcastCustomMessage sends a custom message to all WebSocket clients

func (*EventBridge) GetConnectedClients

func (eb *EventBridge) GetConnectedClients() int

GetConnectedClients returns the number of connected WebSocket clients

func (*EventBridge) IsActive

func (eb *EventBridge) IsActive() bool

IsActive returns whether the event bridge is active

func (*EventBridge) Start

func (eb *EventBridge) Start() error

Start begins bridging events to WebSocket clients

func (*EventBridge) Stop

func (eb *EventBridge) Stop()

Stop stops the event bridge

type Job

type Job struct {
	ID        string                 `json:"id"`
	Type      string                 `json:"type"`
	Status    string                 `json:"status"`
	Progress  int                    `json:"progress"`
	Result    interface{}            `json:"result,omitempty"`
	Error     string                 `json:"error,omitempty"`
	CreatedAt time.Time              `json:"created_at"`
	UpdatedAt time.Time              `json:"updated_at"`
	Metadata  map[string]interface{} `json:"metadata"`
}

Job represents an async job

type JobManager

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

JobManager manages async jobs

func NewJobManager

func NewJobManager() *JobManager

NewJobManager creates a new job manager

func (*JobManager) CreateJob

func (jm *JobManager) CreateJob(jobType string) *Job

CreateJob creates a new job

func (*JobManager) GetActiveJobCount

func (jm *JobManager) GetActiveJobCount() int

GetActiveJobCount returns the count of active jobs

func (*JobManager) GetFilteredJobs

func (jm *JobManager) GetFilteredJobs(jobType, status string, limit int) []*Job

GetFilteredJobs returns filtered jobs

func (*JobManager) GetJob

func (jm *JobManager) GetJob(id string) (*Job, bool)

GetJob retrieves a job by ID

func (*JobManager) UpdateJob

func (jm *JobManager) UpdateJob(id string, updates map[string]interface{}) error

UpdateJob updates a job

type ServerMetricsInterface

type ServerMetricsInterface interface {
	IncrementWSMessagesSent()
}

ServerMetricsInterface defines the interface for tracking server metrics

type WebSocketClient

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

WebSocketClient represents a connected WebSocket client

type WebSocketCommand

type WebSocketCommand struct {
	Command string                 `json:"command"`
	Params  map[string]interface{} `json:"params"`
	ID      string                 `json:"id"`
}

WebSocketCommand represents a command from a WebSocket client

type WebSocketMessage

type WebSocketMessage struct {
	Type      string                 `json:"type"`
	ID        string                 `json:"id,omitempty"`
	Timestamp time.Time              `json:"timestamp"`
	Data      map[string]interface{} `json:"data"`
}

WebSocketMessage represents a WebSocket message

Jump to

Keyboard shortcuts

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