websocket

package
v0.6.1-0...-c79f37a Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedMessageType = errors.New("unsupported message type")
)

Functions

func MapMessageInfo

func MapMessageInfo(m []byte) (*sdk.WsMessageInfo, error)

Types

type CatapultClient

type CatapultClient interface {
	Client

	Config() *sdk.Config
	AddBlockHandlers(handlers ...subscribers.BlockHandler) error
	AddConfirmedAddedHandlers(address *sdk.Address, handlers ...subscribers.ConfirmedAddedHandler) error
	AddUnconfirmedAddedHandlers(address *sdk.Address, handlers ...subscribers.UnconfirmedAddedHandler) error
	AddUnconfirmedRemovedHandlers(address *sdk.Address, handlers ...subscribers.UnconfirmedRemovedHandler) error
	AddPartialAddedHandlers(address *sdk.Address, handlers ...subscribers.PartialAddedHandler) error
	AddPartialRemovedHandlers(address *sdk.Address, handlers ...subscribers.PartialRemovedHandler) error
	AddStatusHandlers(address *sdk.Address, handlers ...subscribers.StatusHandler) error
	AddCosignatureHandlers(address *sdk.Address, handlers ...subscribers.CosignatureHandler) error
	AddDriveStateHandlers(address *sdk.Address, handlers ...subscribers.DriveStateHandler) error
}

func NewClient

func NewClient(ctx context.Context, cfg *sdk.Config) (CatapultClient, error)

type CatapultWebsocketClientImpl

type CatapultWebsocketClientImpl struct {
	UID string
	// contains filtered or unexported fields
}

func (*CatapultWebsocketClientImpl) AddBlockHandlers

func (c *CatapultWebsocketClientImpl) AddBlockHandlers(handlers ...subscribers.BlockHandler) error

func (*CatapultWebsocketClientImpl) AddConfirmedAddedHandlers

func (c *CatapultWebsocketClientImpl) AddConfirmedAddedHandlers(address *sdk.Address, handlers ...subscribers.ConfirmedAddedHandler) error

func (*CatapultWebsocketClientImpl) AddCosignatureHandlers

func (c *CatapultWebsocketClientImpl) AddCosignatureHandlers(address *sdk.Address, handlers ...subscribers.CosignatureHandler) error

func (*CatapultWebsocketClientImpl) AddDriveStateHandlers

func (c *CatapultWebsocketClientImpl) AddDriveStateHandlers(address *sdk.Address, handlers ...subscribers.DriveStateHandler) error

func (*CatapultWebsocketClientImpl) AddPartialAddedHandlers

func (c *CatapultWebsocketClientImpl) AddPartialAddedHandlers(address *sdk.Address, handlers ...subscribers.PartialAddedHandler) error

func (*CatapultWebsocketClientImpl) AddPartialRemovedHandlers

func (c *CatapultWebsocketClientImpl) AddPartialRemovedHandlers(address *sdk.Address, handlers ...subscribers.PartialRemovedHandler) error

func (*CatapultWebsocketClientImpl) AddStatusHandlers

func (c *CatapultWebsocketClientImpl) AddStatusHandlers(address *sdk.Address, handlers ...subscribers.StatusHandler) error

func (*CatapultWebsocketClientImpl) AddUnconfirmedAddedHandlers

func (c *CatapultWebsocketClientImpl) AddUnconfirmedAddedHandlers(address *sdk.Address, handlers ...subscribers.UnconfirmedAddedHandler) error

func (*CatapultWebsocketClientImpl) AddUnconfirmedRemovedHandlers

func (c *CatapultWebsocketClientImpl) AddUnconfirmedRemovedHandlers(address *sdk.Address, handlers ...subscribers.UnconfirmedRemovedHandler) error

func (*CatapultWebsocketClientImpl) Close

func (*CatapultWebsocketClientImpl) Config

func (c *CatapultWebsocketClientImpl) Config() *sdk.Config

func (*CatapultWebsocketClientImpl) Listen

func (c *CatapultWebsocketClientImpl) Listen()

type Client

type Client interface {
	io.Closer

	Listen()
}

type MessageInfoMapper

type MessageInfoMapper interface {
	MapMessageInfo([]byte) (*sdk.WsMessageInfo, error)
}

type MessagePublisher

type MessagePublisher interface {
	PublishSubscribeMessage(uid string, path Path) error
	PublishUnsubscribeMessage(uid string, path Path) error
	SetConn(conn *websocket.Conn)
}

type MockMessagePublisher

type MockMessagePublisher struct {
	mock.Mock
}

MockMessagePublisher is an autogenerated mock type for the MessagePublisher type

func (*MockMessagePublisher) PublishSubscribeMessage

func (_m *MockMessagePublisher) PublishSubscribeMessage(uid string, path Path) error

PublishSubscribeMessage provides a mock function with given fields: uid, path

func (*MockMessagePublisher) PublishUnsubscribeMessage

func (_m *MockMessagePublisher) PublishUnsubscribeMessage(uid string, path Path) error

PublishUnsubscribeMessage provides a mock function with given fields: uid, path

func (*MockMessagePublisher) SetConn

func (_m *MockMessagePublisher) SetConn(conn *websocket.Conn)

SetConn provides a mock function with given fields: conn

type MockTopicHandlersStorage

type MockTopicHandlersStorage struct {
	mock.Mock
}

MockTopicHandlersStorage is an autogenerated mock type for the TopicHandlersStorage type

func (*MockTopicHandlersStorage) GetHandler

func (_m *MockTopicHandlersStorage) GetHandler(path Path) *TopicHandler

GetHandler provides a mock function with given fields: path

func (*MockTopicHandlersStorage) HasHandler

func (_m *MockTopicHandlersStorage) HasHandler(path Path) bool

HasHandler provides a mock function with given fields: path

func (*MockTopicHandlersStorage) SetTopicHandler

func (_m *MockTopicHandlersStorage) SetTopicHandler(path Path, handler *TopicHandler)

SetTopicHandler provides a mock function with given fields: path, handler

type Path

type Path string

Subscribe path

type Router

type Router interface {
	RouteMessage([]byte)
	SetUid(string)
}

func NewRouter

func NewRouter(uid string, publisher MessagePublisher, topicHandlers TopicHandlersStorage) Router

type Topic

type Topic interface {
	Format(info *sdk.WsMessageInfo) Path
}

type TopicHandler

type TopicHandler struct {
	Topic
	handlers.Handler
}

type TopicHandlersStorage

type TopicHandlersStorage interface {
	HasHandler(path Path) bool
	GetHandler(path Path) *TopicHandler
	SetTopicHandler(path Path, handler *TopicHandler)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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