Documentation
¶
Index ¶
- Constants
- type AccountStatusesResponse
- type Arguments
- type BaseMessageRequest
- type BaseMessageResponse
- type BlockDigestMessageResponse
- type BlockHeaderMessageResponse
- type BlockMessageResponse
- type ErrorMessage
- type EventResponse
- type ListSubscriptionsMessageRequest
- type ListSubscriptionsMessageResponse
- type SubscribeMessageRequest
- type SubscribeMessageResponse
- type SubscriptionEntry
- type TransactionStatusesResponse
- type UnsubscribeMessageRequest
- type UnsubscribeMessageResponse
Constants ¶
const ( SubscribeAction = "subscribe" UnsubscribeAction = "unsubscribe" ListSubscriptionsAction = "list_subscription" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountStatusesResponse ¶
type AccountStatusesResponse struct {
BlockID string `json:"blockID"`
Height string `json:"height"`
AccountEvents map[string]flow.EventsList `json:"account_events"`
MessageIndex uint64 `json:"message_index"`
}
AccountStatusesResponse is the response message for 'events' topic.
type BaseMessageRequest ¶
type BaseMessageRequest struct {
Action string `json:"action"` // subscribe, unsubscribe or list_subscriptions
ClientMessageID string `json:"message_id"` // ClientMessageID is a uuid generated by client to identify request/response uniquely
}
BaseMessageRequest represents a base structure for incoming messages.
type BaseMessageResponse ¶
type BaseMessageResponse struct {
SubscriptionID string `json:"subscription_id"`
ClientMessageID string `json:"message_id,omitempty"` // ClientMessageID may be empty in case we send msg by ourselves (e.g. error occurred)
Success bool `json:"success"`
Error ErrorMessage `json:"error,omitempty"`
}
BaseMessageResponse represents a base structure for outgoing messages.
type BlockDigestMessageResponse ¶
type BlockDigestMessageResponse struct {
// The sealed or finalized block digest according to the block status
// in the request.
Block *flow.BlockDigest `json:"block_digest"`
}
BlockDigestMessageResponse is the response message for 'block_digests' topic.
type BlockHeaderMessageResponse ¶
type BlockHeaderMessageResponse struct {
// The sealed or finalized block headers according to the block status
// in the request.
Header *flow.Header `json:"header"`
}
BlockHeaderMessageResponse is the response message for 'block_headers' topic.
type BlockMessageResponse ¶
type BlockMessageResponse struct {
// The sealed or finalized blocks according to the block status
// in the request.
Block *flow.Block `json:"block"`
}
BlockMessageResponse is the response message for 'blocks' topic.
type ErrorMessage ¶
type EventResponse ¶
type EventResponse struct {
BlockId string `json:"block_id"`
BlockHeight string `json:"block_height"`
BlockTimestamp time.Time `json:"block_timestamp"`
Events []flow.Event `json:"events"`
MessageIndex uint64 `json:"message_index"`
}
EventResponse is the response message for 'events' topic.
type ListSubscriptionsMessageRequest ¶
type ListSubscriptionsMessageRequest struct {
BaseMessageRequest
}
ListSubscriptionsMessageRequest represents a request to list active subscriptions.
type ListSubscriptionsMessageResponse ¶
type ListSubscriptionsMessageResponse struct {
ClientMessageID string `json:"message_id"`
Success bool `json:"success"`
Error ErrorMessage `json:"error,omitempty"`
Subscriptions []*SubscriptionEntry `json:"subscriptions,omitempty"`
}
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 {
Topic string `json:"topic,omitempty"` // Topic of the subscription
ID string `json:"id,omitempty"` // Unique subscription ID
}
SubscriptionEntry represents an active subscription entry.
type TransactionStatusesResponse ¶
type TransactionStatusesResponse struct {
TransactionResult *access.TransactionResult `json:"transaction_result"`
MessageIndex uint64 `json:"message_index"`
}
TransactionStatusesResponse is the response message for 'events' topic.
type UnsubscribeMessageRequest ¶
type UnsubscribeMessageRequest struct {
BaseMessageRequest
SubscriptionID string `json:"id"`
}
UnsubscribeMessageRequest represents a request to unsubscribe from a topic.
type UnsubscribeMessageResponse ¶
type UnsubscribeMessageResponse struct {
BaseMessageResponse
}
UnsubscribeMessageResponse represents the response to an unsubscription request.