gmclient

package
v0.0.0-...-6005cdf Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InsertOperation is the insert value
	InsertOperation = "insert"
	// DeleteOperation is the delete value
	DeleteOperation = "delete"
	// StatusOperation is the status value
	StatusOperation = "status"
)
View Source
const (
	// RetryCount is count of retrying to connecting to global manager
	RetryCount = 5
	// RetryConnectIntervalSeconds is interval time of retrying to connecting to global manager
	RetryConnectIntervalSeconds = 5
	// MessageChannelCacheSize is size of channel cache
	MessageChannelCacheSize = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientI

type ClientI interface {
	Start() error
	WriteMessage(messageBody interface{}, messageHeader MessageHeader) error
	Subscribe(m MessageResourceHandler) error
}

func NewWebSocketClient

func NewWebSocketClient(options *options.LocalControllerOptions) ClientI

NewWebSocketClient creates client

type Message

type Message struct {
	Header  MessageHeader `json:"header"`
	Content []byte        `json:"content"`
}

Message defines message

type MessageHeader

type MessageHeader struct {
	Namespace    string `json:"namespace"`
	ResourceKind string `json:"resourceKind"`
	ResourceName string `json:"resourceName"`
	Operation    string `json:"operation"`
}

MessageHeader define header of message

type MessageResourceHandler

type MessageResourceHandler interface {
	GetName() string
	Insert(*Message) error
	Delete(*Message) error
}

type WSConnection

type WSConnection struct {
	WSConn *websocket.Conn
}

WSConnection defines conn

Jump to

Keyboard shortcuts

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