protocol

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 2 Imported by: 0

Documentation

Overview

Package protocol defines shared types and messages for Hub-Agent communication.

Index

Constants

View Source
const (
	// WSWriteWait is the time allowed to write a message.
	WSWriteWait = 30 * time.Second

	// WSPongWait is the time to wait for a pong response.
	WSPongWait = 15 * time.Second

	// WSPingPeriod is how often to send pings (must be < PongWait).
	WSPingPeriod = 5 * time.Second

	// WSMaxMessageSize is the maximum message size in bytes (50MB).
	WSMaxMessageSize = 50 * 1024 * 1024

	// WSChunkSize is the size for binary chunks (1MB).
	WSChunkSize = 1024 * 1024

	// WSRequestTimeout is the timeout for request/response operations.
	WSRequestTimeout = 30 * time.Second
)

WebSocket timing constants.

View Source
const (
	WSErrCodeBadRequest     = 400
	WSErrCodeUnauthorized   = 401
	WSErrCodeNotFound       = 404
	WSErrCodeNotAccepted    = 406
	WSErrCodeConflict       = 409
	WSErrCodeInternal       = 500
	WSErrCodeNotImplemented = 501
)

Common WebSocket error codes.

View Source
const (
	LogLevelLog   uint32 = 1  // 0x01
	LogLevelWarn  uint32 = 2  // 0x02
	LogLevelError uint32 = 4  // 0x04
	LogLevelInfo  uint32 = 8  // 0x08
	LogLevelDebug uint32 = 16 // 0x10

	// LogLevelDefault enables Log, Warn, Error, Info (Debug off).
	LogLevelDefault uint32 = LogLevelLog | LogLevelWarn | LogLevelError | LogLevelInfo // 15
)

Console log level bitmask constants.

Variables

This section is empty.

Functions

func LogLevelBit added in v0.6.0

func LogLevelBit(level string) uint32

LogLevelBit maps a CDP log level string to its bitmask bit. Returns 0 for unknown levels.

Types

type AgentInfo

type AgentInfo struct {
	ID                    string   `json:"id"`
	Name                  string   `json:"name"`
	Platform              string   `json:"platform"`
	Version               string   `json:"version"`
	AcceptConnections     bool     `json:"acceptConnections"`
	SupportedImageFormats []string `json:"supportedImageFormats"`
}

AgentInfo contains information about a discovered agent.

type AgentStatusResponse

type AgentStatusResponse struct {
	Name              string `json:"name"`
	Version           string `json:"version"`
	Platform          string `json:"platform"`
	AcceptConnections bool   `json:"acceptConnections"`
	TelemetryEnabled  bool   `json:"telemetryEnabled"`
	TelemetryInterval int    `json:"telemetryInterval"`
	ConsoleLogEnabled bool   `json:"consoleLogEnabled"`
}

AgentStatusResponse is the Agent's response to a Hub connection.

type ApplyArtworkRequest

type ApplyArtworkRequest struct {
	UserID  string         `json:"userId"`
	AppID   uint32         `json:"appId"`
	Artwork *ArtworkConfig `json:"artwork"`
}

ApplyArtworkRequest requests artwork application.

type ArtworkConfig

type ArtworkConfig struct {
	Grid   string `json:"grid,omitempty"`   // 600x900 portrait
	Hero   string `json:"hero,omitempty"`   // 1920x620 header
	Icon   string `json:"icon,omitempty"`   // square icon
	Banner string `json:"banner,omitempty"` // 460x215 horizontal
}

ArtworkConfig defines artwork paths for a shortcut.

type ArtworkFailed

type ArtworkFailed struct {
	Type  string `json:"type"`
	Error string `json:"error"`
}

ArtworkFailed represents a failed artwork application.

type ArtworkImageResponse added in v0.3.0

type ArtworkImageResponse struct {
	Success     bool   `json:"success"`
	ArtworkType string `json:"artworkType"`
	Error       string `json:"error,omitempty"`
}

ArtworkImageResponse contains the result of a binary artwork image transfer.

type ArtworkResponse

type ArtworkResponse struct {
	Applied []string        `json:"applied"`
	Failed  []ArtworkFailed `json:"failed,omitempty"`
}

ArtworkResponse contains artwork operation result.

type BatteryMetrics added in v0.6.0

type BatteryMetrics struct {
	Capacity int    `json:"capacity"`
	Status   string `json:"status"`
}

BatteryMetrics contains battery status.

type CPUMetrics added in v0.6.0

type CPUMetrics struct {
	UsagePercent float64 `json:"usagePercent"`
	TempCelsius  float64 `json:"tempCelsius"`
	FreqMHz      float64 `json:"freqMHz"`
}

CPUMetrics contains CPU usage, temperature and frequency.

type CancelUploadRequest

type CancelUploadRequest struct {
	UploadID string `json:"uploadId"`
}

CancelUploadRequest cancels an active upload.

type CompleteUploadRequest

type CompleteUploadRequest struct {
	UploadID       string `json:"uploadId"`
	CreateShortcut bool   `json:"createShortcut"`
}

CompleteUploadRequest finalizes an upload.

type CompleteUploadRequestFull

type CompleteUploadRequestFull struct {
	UploadID       string          `json:"uploadId"`
	CreateShortcut bool            `json:"createShortcut"`
	Shortcut       *ShortcutConfig `json:"shortcut,omitempty"`
}

CompleteUploadRequestFull includes shortcut configuration.

type CompleteUploadResponse

type CompleteUploadResponse struct {
	UploadID string `json:"uploadId"`
	Success  bool   `json:"success"`
}

CompleteUploadResponse confirms upload completion.

type CompleteUploadResponseFull

type CompleteUploadResponseFull struct {
	Success bool   `json:"success"`
	Path    string `json:"path,omitempty"`
	AppID   uint32 `json:"appId,omitempty"`
}

CompleteUploadResponseFull includes the result path and appID.

type ConfigResponse

type ConfigResponse struct {
	InstallPath string `json:"installPath"`
}

ConfigResponse contains agent configuration.

type ConsoleLogBatch added in v0.6.0

type ConsoleLogBatch struct {
	Entries []ConsoleLogEntry `json:"entries"`
	Dropped int               `json:"dropped"`
}

ConsoleLogBatch contains a batch of console log entries.

type ConsoleLogEntry added in v0.6.0

type ConsoleLogEntry struct {
	Timestamp int64           `json:"timestamp"`
	Level     string          `json:"level"`
	Source    string          `json:"source"`
	Text      string          `json:"text"`
	URL       string          `json:"url,omitempty"`
	Line      int             `json:"line,omitempty"`
	Segments  []StyledSegment `json:"segments,omitempty"`
}

ConsoleLogEntry represents a single console log entry from CEF/CDP.

type ConsoleLogStatusEvent added in v0.6.0

type ConsoleLogStatusEvent struct {
	Enabled   bool   `json:"enabled"`
	LevelMask uint32 `json:"levelMask"`
}

ConsoleLogStatusEvent is sent when console log streaming is enabled/disabled.

type CreateShortcutRequest

type CreateShortcutRequest struct {
	UserID   uint32         `json:"userId"`
	Shortcut ShortcutConfig `json:"shortcut"`
}

CreateShortcutRequest creates a Steam shortcut.

type CreateShortcutResponse

type CreateShortcutResponse struct {
	AppID          uint32 `json:"appId"`
	SteamRestarted bool   `json:"steamRestarted,omitempty"`
}

CreateShortcutResponse contains the result of shortcut creation.

type DeleteGameRequest

type DeleteGameRequest struct {
	AppID uint32 `json:"appId"`
}

DeleteGameRequest requests deletion of a game. Agent handles everything internally.

type DeleteGameResponse

type DeleteGameResponse struct {
	Status         string `json:"status"`
	GameName       string `json:"gameName"`
	SteamRestarted bool   `json:"steamRestarted"`
}

DeleteGameResponse contains the result of game deletion.

type DeleteShortcutRequest

type DeleteShortcutRequest struct {
	UserID uint32 `json:"userId"`
	AppID  uint32 `json:"appId,omitempty"`
	Name   string `json:"name,omitempty"`
}

DeleteShortcutRequest removes a Steam shortcut.

type DeleteShortcutWithRestartRequest

type DeleteShortcutWithRestartRequest struct {
	UserID       string `json:"userId"`
	AppID        uint32 `json:"appId"`
	RestartSteam bool   `json:"restartSteam,omitempty"`
}

DeleteShortcutRequest with restart option.

type ErrorResponse

type ErrorResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Details string `json:"details,omitempty"`
}

ErrorResponse contains error details.

type FanMetrics added in v0.6.0

type FanMetrics struct {
	RPM int `json:"rpm"`
}

FanMetrics contains fan speed information.

type FileEntry

type FileEntry struct {
	RelativePath string `json:"relativePath"`
	Size         int64  `json:"size"`
}

FileEntry represents a file in the upload manifest.

type GPUMetrics added in v0.6.0

type GPUMetrics struct {
	UsagePercent   float64 `json:"usagePercent"`
	TempCelsius    float64 `json:"tempCelsius"`
	FreqMHz        float64 `json:"freqMHz"`
	MemFreqMHz     float64 `json:"memFreqMHz,omitempty"`
	VRAMUsedBytes  int64   `json:"vramUsedBytes,omitempty"`
	VRAMTotalBytes int64   `json:"vramTotalBytes,omitempty"`
}

GPUMetrics contains GPU usage, temperature, frequency and VRAM.

type GameLogWrapperStatusEvent added in v0.6.0

type GameLogWrapperStatusEvent struct {
	Wrappers map[uint32]bool `json:"wrappers"`
}

GameLogWrapperStatusEvent reports the wrapper state for all tracked games.

type HubConnectedRequest

type HubConnectedRequest struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	Platform string `json:"platform,omitempty"` // Hub platform (windows, linux, darwin)
	HubID    string `json:"hubId,omitempty"`    // Unique Hub identifier
	Token    string `json:"token,omitempty"`    // Auth token from previous pairing
}

HubConnectedRequest is sent when a Hub connects to an Agent.

type InfoResponse

type InfoResponse struct {
	Agent AgentInfo `json:"agent"`
}

InfoResponse contains agent information.

type InitUploadRequest

type InitUploadRequest struct {
	Config     UploadConfig `json:"config"`
	TotalSize  int64        `json:"totalSize"`
	FileCount  int          `json:"fileCount"`
	ResumeFrom int64        `json:"resumeFrom,omitempty"`
}

InitUploadRequest starts a new upload session.

type InitUploadRequestFull

type InitUploadRequestFull struct {
	Config    UploadConfig `json:"config"`
	TotalSize int64        `json:"totalSize"`
	Files     []FileEntry  `json:"files"`
}

InitUploadRequestFull includes file entries for the upload.

type InitUploadResponse

type InitUploadResponse struct {
	UploadID   string `json:"uploadId"`
	ResumeFrom int64  `json:"resumeFrom"`
}

InitUploadResponse acknowledges upload initialization.

type InitUploadResponseFull

type InitUploadResponseFull struct {
	UploadID   string           `json:"uploadId"`
	ChunkSize  int              `json:"chunkSize"`
	ResumeFrom map[string]int64 `json:"resumeFrom,omitempty"`
}

InitUploadResponseFull includes chunk size configuration.

type ListShortcutsRequest

type ListShortcutsRequest struct {
	UserID uint32 `json:"userId"`
}

ListShortcutsRequest lists shortcuts for a user.

type MemoryMetrics added in v0.6.0

type MemoryMetrics struct {
	TotalBytes     int64   `json:"totalBytes"`
	AvailableBytes int64   `json:"availableBytes"`
	UsagePercent   float64 `json:"usagePercent"`
	SwapTotalBytes int64   `json:"swapTotalBytes,omitempty"`
	SwapFreeBytes  int64   `json:"swapFreeBytes,omitempty"`
}

MemoryMetrics contains memory and swap usage information.

type Message

type Message struct {
	ID      string          `json:"id"`
	Type    MessageType     `json:"type"`
	Payload json.RawMessage `json:"payload,omitempty"`
	Error   *WSError        `json:"error,omitempty"`
}

Message is the envelope for all WebSocket communication.

func NewErrorMessage

func NewErrorMessage(id string, code int, message string) *Message

NewErrorMessage creates an error response message.

func NewMessage

func NewMessage(id string, msgType MessageType, payload any) (*Message, error)

NewMessage creates a new message with the given type and payload.

func (*Message) ParsePayload

func (m *Message) ParsePayload(v any) error

ParsePayload unmarshals the payload into the given type.

func (*Message) Reply

func (m *Message) Reply(msgType MessageType, payload any) (*Message, error)

Reply creates a response message for this request.

func (*Message) ReplyError

func (m *Message) ReplyError(code int, message string) *Message

ReplyError creates an error response for this request.

type MessageType

type MessageType string

MessageType identifies the type of WebSocket message.

const (
	// Connection management
	MsgTypeHubConnected MessageType = "hub_connected" // Hub → Agent: handshake
	MsgTypeAgentStatus  MessageType = "agent_status"  // Agent → Hub: handshake response

	// Authentication / Pairing
	MsgTypePairingRequired MessageType = "pairing_required" // Agent → Hub: requires pairing
	MsgTypePairConfirm     MessageType = "pair_confirm"     // Hub → Agent: confirm pairing code
	MsgTypePairSuccess     MessageType = "pair_success"     // Agent → Hub: pairing successful
	MsgTypePairFailed      MessageType = "pair_failed"      // Agent → Hub: pairing failed

	// Requests from Hub to Agent
	MsgTypeSetConsoleLogFilter  MessageType = "set_console_log_filter"  // Hub → Agent: configure log level filter
	MsgTypeSetConsoleLogEnabled MessageType = "set_console_log_enabled" // Hub → Agent: enable/disable console log
	MsgTypeSetGameLogWrapper    MessageType = "set_game_log_wrapper"    // Hub → Agent: enable/disable game log wrapper
	MsgTypePing                 MessageType = "ping"
	MsgTypeGetInfo              MessageType = "get_info"
	MsgTypeGetConfig            MessageType = "get_config"
	MsgTypeGetSteamUsers        MessageType = "get_steam_users"
	MsgTypeListShortcuts        MessageType = "list_shortcuts"
	MsgTypeCreateShortcut       MessageType = "create_shortcut"
	MsgTypeDeleteShortcut       MessageType = "delete_shortcut"
	MsgTypeDeleteGame           MessageType = "delete_game" // Agent handles everything internally
	MsgTypeApplyArtwork         MessageType = "apply_artwork"
	MsgTypeSendArtworkImage     MessageType = "send_artwork_image" // Hub → Agent: binary image data
	MsgTypeRestartSteam         MessageType = "restart_steam"
	MsgTypeInitUpload           MessageType = "init_upload"
	MsgTypeUploadChunk          MessageType = "upload_chunk"
	MsgTypeCompleteUpload       MessageType = "complete_upload"
	MsgTypeCancelUpload         MessageType = "cancel_upload"

	// Responses from Agent to Hub
	MsgTypePong                 MessageType = "pong"
	MsgTypeInfoResponse         MessageType = "info_response"
	MsgTypeConfigResponse       MessageType = "config_response"
	MsgTypeSteamUsersResponse   MessageType = "steam_users_response"
	MsgTypeShortcutsResponse    MessageType = "shortcuts_response"
	MsgTypeArtworkResponse      MessageType = "artwork_response"
	MsgTypeArtworkImageResponse MessageType = "artwork_image_response" // Agent → Hub: ack for binary artwork
	MsgTypeSteamResponse        MessageType = "steam_response"
	MsgTypeUploadInitResponse   MessageType = "upload_init_response"
	MsgTypeUploadChunkResponse  MessageType = "upload_chunk_response"
	MsgTypeOperationResult      MessageType = "operation_result"
	MsgTypeError                MessageType = "error"

	// Events from Agent to Hub (push notifications)
	MsgTypeUploadProgress       MessageType = "upload_progress"
	MsgTypeOperationEvent       MessageType = "operation_event"
	MsgTypeTelemetryStatus      MessageType = "telemetry_status"
	MsgTypeTelemetryData        MessageType = "telemetry_data"
	MsgTypeConsoleLogStatus     MessageType = "console_log_status"
	MsgTypeConsoleLogData       MessageType = "console_log_data"
	MsgTypeGameLogWrapperStatus MessageType = "game_log_wrapper_status"
)

type OperationEvent

type OperationEvent struct {
	Type     string  `json:"type"`   // "install", "delete"
	Status   string  `json:"status"` // "start", "progress", "complete", "error"
	GameName string  `json:"gameName"`
	Progress float64 `json:"progress"` // 0-100
	Message  string  `json:"message,omitempty"`
}

OperationEvent is a push notification for operation progress.

type OperationResult

type OperationResult struct {
	Success bool   `json:"success"`
	Message string `json:"message,omitempty"`
}

OperationResult is a generic result for operations.

type PairConfirmRequest

type PairConfirmRequest struct {
	Code string `json:"code"` // 6-digit code entered by user
}

PairConfirmRequest is sent by Hub to confirm pairing.

type PairFailedResponse

type PairFailedResponse struct {
	Reason string `json:"reason"` // Failure reason
}

PairFailedResponse is sent when pairing fails.

type PairSuccessResponse

type PairSuccessResponse struct {
	Token string `json:"token"` // Auth token for future connections
}

PairSuccessResponse is sent when pairing is successful.

type PairingRequiredResponse

type PairingRequiredResponse struct {
	Code      string `json:"code"`      // 6-digit pairing code
	ExpiresIn int    `json:"expiresIn"` // Seconds until expiration
}

PairingRequiredResponse is sent when a Hub needs to pair.

type PowerMetrics added in v0.6.0

type PowerMetrics struct {
	TDPWatts   float64 `json:"tdpWatts"`
	PowerWatts float64 `json:"powerWatts"`
}

PowerMetrics contains TDP and power draw information.

type RestartSteamResponse

type RestartSteamResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

RestartSteamResponse contains the result of Steam restart.

type SetConsoleLogEnabledRequest added in v0.6.0

type SetConsoleLogEnabledRequest struct {
	Enabled bool `json:"enabled"`
}

SetConsoleLogEnabledRequest enables or disables console log streaming on the agent.

type SetConsoleLogEnabledResponse added in v0.6.0

type SetConsoleLogEnabledResponse struct {
	Enabled bool `json:"enabled"`
}

SetConsoleLogEnabledResponse confirms the console log enabled state.

type SetConsoleLogFilterRequest added in v0.6.0

type SetConsoleLogFilterRequest struct {
	LevelMask uint32 `json:"levelMask"`
}

SetConsoleLogFilterRequest sets which log levels the agent should collect.

type SetConsoleLogFilterResponse added in v0.6.0

type SetConsoleLogFilterResponse struct {
	LevelMask uint32 `json:"levelMask"`
}

SetConsoleLogFilterResponse confirms the applied log level mask.

type SetGameLogWrapperRequest added in v0.6.0

type SetGameLogWrapperRequest struct {
	AppID   uint32 `json:"appId"`
	Enabled bool   `json:"enabled"`
}

SetGameLogWrapperRequest enables or disables the game log wrapper for a specific game.

type SetGameLogWrapperResponse added in v0.6.0

type SetGameLogWrapperResponse struct {
	AppID   uint32 `json:"appId"`
	Enabled bool   `json:"enabled"`
}

SetGameLogWrapperResponse confirms the game log wrapper state.

type ShortcutConfig

type ShortcutConfig struct {
	Name          string         `json:"name"`
	Exe           string         `json:"exe"`
	StartDir      string         `json:"startDir"`
	LaunchOptions string         `json:"launchOptions,omitempty"`
	Tags          []string       `json:"tags,omitempty"`
	Artwork       *ArtworkConfig `json:"artwork,omitempty"`
}

ShortcutConfig defines the configuration for creating a Steam shortcut.

type ShortcutInfo

type ShortcutInfo struct {
	AppID         uint32   `json:"appId"`
	Name          string   `json:"name"`
	Exe           string   `json:"exe"`
	StartDir      string   `json:"startDir"`
	LaunchOptions string   `json:"launchOptions,omitempty"`
	Tags          []string `json:"tags,omitempty"`
	LastPlayed    int64    `json:"lastPlayed,omitempty"`
}

ShortcutInfo contains information about an existing shortcut.

type ShortcutResponse

type ShortcutResponse struct {
	Success   bool           `json:"success"`
	Shortcuts []ShortcutInfo `json:"shortcuts,omitempty"`
}

ShortcutResponse contains shortcut operation result.

type ShortcutsListResponse

type ShortcutsListResponse struct {
	Shortcuts []ShortcutInfo `json:"shortcuts"`
}

ShortcutsListResponse contains the list of shortcuts.

type SteamStatus added in v0.6.0

type SteamStatus struct {
	Running    bool `json:"running"`
	GamingMode bool `json:"gamingMode"`
}

SteamStatus contains Steam process status.

type SteamStatusResponse

type SteamStatusResponse struct {
	Running bool   `json:"running"`
	Path    string `json:"path,omitempty"`
}

SteamStatusResponse contains Steam status.

type SteamUser

type SteamUser struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	AvatarURL   string `json:"avatarUrl,omitempty"`
	LastLoginAt int64  `json:"lastLoginAt,omitempty"`
}

SteamUser represents a Steam user (matches steam.User).

type SteamUsersResponse

type SteamUsersResponse struct {
	Users []SteamUser `json:"users"`
}

SteamUsersResponse contains the list of Steam users.

type StyledSegment added in v0.6.0

type StyledSegment struct {
	Text string `json:"text"`
	CSS  string `json:"css,omitempty"`
}

StyledSegment represents a text segment with optional CSS styling from console %c directives.

type TelemetryData added in v0.6.0

type TelemetryData struct {
	Timestamp int64           `json:"timestamp"`
	CPU       *CPUMetrics     `json:"cpu,omitempty"`
	GPU       *GPUMetrics     `json:"gpu,omitempty"`
	Memory    *MemoryMetrics  `json:"memory,omitempty"`
	Battery   *BatteryMetrics `json:"battery,omitempty"`
	Power     *PowerMetrics   `json:"power,omitempty"`
	Fan       *FanMetrics     `json:"fan,omitempty"`
	Steam     *SteamStatus    `json:"steam,omitempty"`
}

TelemetryData contains hardware metrics from the Agent.

type TelemetryStatusEvent added in v0.6.0

type TelemetryStatusEvent struct {
	Enabled  bool `json:"enabled"`
	Interval int  `json:"interval"`
}

TelemetryStatusEvent is sent when telemetry is enabled/disabled on the Agent.

type UploadChunkRequest

type UploadChunkRequest struct {
	UploadID string `json:"uploadId"`
	Offset   int64  `json:"offset"`
	Data     []byte `json:"data"`
	FilePath string `json:"filePath"`
	IsLast   bool   `json:"isLast"`
}

UploadChunkRequest sends a chunk of data.

type UploadChunkRequestFull

type UploadChunkRequestFull struct {
	UploadID string `json:"uploadId"`
	FilePath string `json:"filePath"`
	Offset   int64  `json:"offset"`
	Size     int    `json:"size"`
	Checksum string `json:"checksum,omitempty"`
}

UploadChunkRequestFull includes all chunk metadata.

type UploadChunkResponse

type UploadChunkResponse struct {
	UploadID     string `json:"uploadId"`
	BytesWritten int64  `json:"bytesWritten"`
	TotalWritten int64  `json:"totalWritten"`
}

UploadChunkResponse acknowledges a chunk.

type UploadConfig

type UploadConfig struct {
	GameName      string `json:"gameName"`
	InstallPath   string `json:"installPath"`
	Executable    string `json:"executable"`
	LaunchOptions string `json:"launchOptions,omitempty"`
	Tags          string `json:"tags,omitempty"`
}

UploadConfig defines the configuration for uploading a game.

type UploadProgress

type UploadProgress struct {
	UploadID         string       `json:"uploadId"`
	Status           UploadStatus `json:"status"`
	TotalBytes       int64        `json:"totalBytes"`
	TransferredBytes int64        `json:"transferredBytes"`
	CurrentFile      string       `json:"currentFile,omitempty"`
	StartedAt        time.Time    `json:"startedAt"`
	UpdatedAt        time.Time    `json:"updatedAt"`
	Error            string       `json:"error,omitempty"`
}

UploadProgress contains progress information for an active upload.

func (*UploadProgress) Percentage

func (p *UploadProgress) Percentage() float64

Percentage returns the upload progress as a percentage (0-100).

type UploadProgressEvent

type UploadProgressEvent struct {
	UploadID         string  `json:"uploadId"`
	TransferredBytes int64   `json:"transferredBytes"`
	TotalBytes       int64   `json:"totalBytes"`
	CurrentFile      string  `json:"currentFile,omitempty"`
	Percentage       float64 `json:"percentage"`
}

UploadProgressEvent is sent during upload to report progress.

type UploadStatus

type UploadStatus string

UploadStatus represents the current state of an upload.

const (
	UploadStatusPending    UploadStatus = "pending"
	UploadStatusInProgress UploadStatus = "in_progress"
	UploadStatusCompleted  UploadStatus = "completed"
	UploadStatusFailed     UploadStatus = "failed"
	UploadStatusCancelled  UploadStatus = "cancelled"
)

type WSError

type WSError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

WSError represents an error in a WebSocket message.

Jump to

Keyboard shortcuts

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