websocket

package
v0.0.0-...-cb5d853 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster struct {
	KeySub  string
	Message []byte
}

type ClientMangerCenter

type ClientMangerCenter struct {
	Register   chan *ClientWS
	Unregister chan *ClientWS

	Broadcaster chan *Broadcaster

	MapWSNet
	MapWSSub
}

func NewWsClientMangerCenter

func NewWsClientMangerCenter() *ClientMangerCenter

func (*ClientMangerCenter) Broadcast

func (t *ClientMangerCenter) Broadcast(sub_device SubDevice, message []byte)

func (*ClientMangerCenter) CountNet

func (t *ClientMangerCenter) CountNet() int

func (*ClientMangerCenter) CountSub

func (t *ClientMangerCenter) CountSub() int

func (*ClientMangerCenter) ListNet

func (t *ClientMangerCenter) ListNet() []string

func (*ClientMangerCenter) ListSub

func (t *ClientMangerCenter) ListSub() []string

func (*ClientMangerCenter) Start

func (t *ClientMangerCenter) Start()

type ClientWS

type ClientWS struct {
	KeyNet string
	KeySub string

	Conn *websocket.Conn
	Link *websocket.Conn
	Url  *url.URL

	MsgConn   chan []byte `json:"-"`
	MsgLink   chan []byte `json:"-"`
	SubDevice SubDevice
}

func NewClientWS

func NewClientWS(conn *websocket.Conn, sub_device SubDevice) *ClientWS

func (*ClientWS) Close

func (c *ClientWS) Close()

func (*ClientWS) Read

func (c *ClientWS) Read()

func (*ClientWS) SendMsgConn

func (c *ClientWS) SendMsgConn() (_err error)
func (c *ClientWS) SendMsgLink() (_err error)
func (c *ClientWS) StartLink(t *ClientMangerCenter)
type MapLink struct {
	MapLinkWSSubs map[string]map[string]*ClientWS
	Lock          *sync.RWMutex
}

func (*MapLink) Add

func (t *MapLink) Add(client_ws *ClientWS)

func (*MapLink) Delete

func (t *MapLink) Delete(client_ws *ClientWS)

type MapWSAll

type MapWSAll struct {
	MapClientWSAlls map[string]map[string]*ClientWS
	Lock            *sync.RWMutex
}

type MapWSNet

type MapWSNet struct {
	MapClientWSNets map[string]*ClientWS
	Lock            *sync.RWMutex
}

func (*MapWSNet) Add

func (t *MapWSNet) Add(client_ws *ClientWS)

func (*MapWSNet) Delete

func (t *MapWSNet) Delete(client_ws *ClientWS)

type MapWSSub

type MapWSSub struct {
	MapClientWSSubs map[string]map[string]*ClientWS
	Lock            *sync.RWMutex
}

func (*MapWSSub) Add

func (t *MapWSSub) Add(client_ws *ClientWS)

func (*MapWSSub) Delete

func (t *MapWSSub) Delete(client_ws *ClientWS)

type SubDevice

type SubDevice struct {
	DeviceId string
	IdScheme int

	ZoneId string
}

func (*SubDevice) GetKeySub

func (t *SubDevice) GetKeySub() string

Jump to

Keyboard shortcuts

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