commands

package
v1.0.1-rc.11 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToDeserializeCommand = errors.New("failed to deserialize command")
	ErrFailedToValidateCommand    = errors.New("failed to validate command")
	ErrFailedToSendMessage        = errors.New("failed to send message")
)

Functions

This section is empty.

Types

type BaseCommand

type BaseCommand struct {
	Command CommandType `json:"command"`
}

type BaseEvent

type BaseEvent struct {
	Event EventType `json:"event"`
}

type CommandHandler

type CommandHandler interface {
	SupportsCommand(commandType CommandType) bool
	HandleCommand(client *websockethub.Client, message []byte) error
}

type CommandManager

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

func (*CommandManager) HandleNodeCommands

func (c *CommandManager) HandleNodeCommands(client *websockethub.Client, message []byte) error

type CommandType

type CommandType string
const (
	CommandSubscribe   CommandType = "subscribe"
	CommandUnsubscribe CommandType = "unsubscribe"
)

type EventType

type EventType string
const (
	EventClientWasSubscribed   EventType = "subscribed"
	EventClientWasUnsubscribed EventType = "unsubscribed"
)

type SubscriptionCommand

type SubscriptionCommand struct {
	BaseCommand
	Topic string `json:"topic"`
}

type SubscriptionCommandHandler

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

func (*SubscriptionCommandHandler) HandleCommand

func (s *SubscriptionCommandHandler) HandleCommand(client *websockethub.Client, message []byte) error

func (*SubscriptionCommandHandler) SupportsCommand

func (s *SubscriptionCommandHandler) SupportsCommand(commandType CommandType) bool

type SubscriptionEvent

type SubscriptionEvent struct {
	BaseEvent
	Topic string `json:"topic"`
}

Jump to

Keyboard shortcuts

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