Documentation
¶
Index ¶
- Constants
- type Arguments
- type BaseMessageRequest
- type BaseMessageResponse
- type ErrorMessage
- type ListSubscriptionsMessageRequest
- type ListSubscriptionsMessageResponse
- type SubscribeMessageRequest
- type SubscribeMessageResponse
- type SubscriptionEntry
- type UnsubscribeMessageRequest
- type UnsubscribeMessageResponse
Constants ¶
const ( SubscribeAction = "subscribe" UnsubscribeAction = "unsubscribe" ListSubscriptionsAction = "list_subscriptions" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 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.