Help us shape the future of Go! Take the 2026 Go Developer Survey

models

package
v0.43.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubscribeAction         = "subscribe"
	UnsubscribeAction       = "unsubscribe"
	ListSubscriptionsAction = "list_subscriptions"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments map[string]interface{}

type BaseMessageRequest

type BaseMessageRequest struct {
	// SubscriptionID is UUID generated by either client or server to uniquely identify subscription.
	// It is empty for 'list_subscriptions' action
	SubscriptionID string `json:"subscription_id,omitempty"`
	Action         string `json:"action"` // Action is an action to perform (e.g. 'subscribe' to some data)
}

BaseMessageRequest represents a base structure for incoming messages.

type BaseMessageResponse

type BaseMessageResponse struct {
	SubscriptionID string        `json:"subscription_id"` // SubscriptionID might be empty in case of error response
	Error          *ErrorMessage `json:"error,omitempty"` // Error might be empty in case of OK response
	Action         string        `json:"action"`
}

BaseMessageResponse represents a base structure for outgoing messages.

type ErrorMessage

type ErrorMessage struct {
	Code    int    `json:"code"` // Code is an error code that categorizes an error
	Message string `json:"message"`
}

type ListSubscriptionsMessageRequest

type ListSubscriptionsMessageRequest struct {
	BaseMessageRequest
}

ListSubscriptionsMessageRequest represents a request to list active subscriptions.

type ListSubscriptionsMessageResponse

type ListSubscriptionsMessageResponse struct {
	// Subscription list might be empty in case of no active subscriptions
	Subscriptions []*SubscriptionEntry `json:"subscriptions"`
	Action        string               `json:"action"`
}

ListSubscriptionsMessageResponse is the structure used to respond to list_subscriptions requests. It contains a list of active subscriptions for the current WebSocket connection.

type SubscribeMessageRequest

type SubscribeMessageRequest struct {
	BaseMessageRequest
	Topic     string    `json:"topic"`     // Topic to subscribe to
	Arguments Arguments `json:"arguments"` // Additional arguments for subscription
}

SubscribeMessageRequest represents a request to subscribe to a topic.

type SubscribeMessageResponse

type SubscribeMessageResponse struct {
	BaseMessageResponse
}

SubscribeMessageResponse represents the response to a subscription request.

type SubscriptionEntry

type SubscriptionEntry struct {
	SubscriptionID string    `json:"subscription_id"` // ID is a client generated UUID for subscription
	Topic          string    `json:"topic"`           // Topic of the subscription
	Arguments      Arguments `json:"arguments"`
}

SubscriptionEntry represents an active subscription entry.

type UnsubscribeMessageRequest

type UnsubscribeMessageRequest struct {
	// Note: subscription_id is mandatory for this request
	BaseMessageRequest
}

UnsubscribeMessageRequest represents a request to unsubscribe from a topic.

type UnsubscribeMessageResponse

type UnsubscribeMessageResponse struct {
	BaseMessageResponse
}

UnsubscribeMessageResponse represents the response to an unsubscription request.

Jump to

Keyboard shortcuts

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