commands

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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