ws

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WebSocketHubFactory = HubFactoryFunc(func() Hub {
	return NewHubImpl(NewClientFactory())
})

Functions

This section is empty.

Types

type Client

type Client interface {
	util.Starter
	Broadcast(data []byte)
	UUID() string
}

type ClientFactory

type ClientFactory interface {
	SetHub(hub Hub)
	GetClient(conn *websocket.Conn) Client
}

type ClientImpl

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

func NewClient

func NewClient(hub Hub, conn *websocket.Conn) *ClientImpl

func (*ClientImpl) Broadcast

func (c *ClientImpl) Broadcast(data []byte)

func (*ClientImpl) Start

func (c *ClientImpl) Start()

func (*ClientImpl) UUID

func (c *ClientImpl) UUID() string

type Hub

type Hub interface {
	Broadcast(notification model.ClientNotification)
	Register(conn *websocket.Conn)
	Unregister(clientUUID string)
}

type HubFactory

type HubFactory interface {
	GetHub() Hub
}

type HubFactoryFunc

type HubFactoryFunc func() Hub

func (HubFactoryFunc) GetHub

func (f HubFactoryFunc) GetHub() Hub

type HubImpl

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

func NewHubImpl

func NewHubImpl(clientFactory ClientFactory) *HubImpl

func (*HubImpl) Broadcast

func (h *HubImpl) Broadcast(notification model.ClientNotification)

func (*HubImpl) Register

func (h *HubImpl) Register(conn *websocket.Conn)

func (*HubImpl) Unregister

func (h *HubImpl) Unregister(clientUUID string)

type WebSocketClientFactory

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

func NewClientFactory

func NewClientFactory() *WebSocketClientFactory

func (*WebSocketClientFactory) GetClient

func (f *WebSocketClientFactory) GetClient(conn *websocket.Conn) Client

func (*WebSocketClientFactory) SetHub

func (f *WebSocketClientFactory) SetHub(hub Hub)

Jump to

Keyboard shortcuts

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