ws

package
v1.8.22 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthInfoRefresh

func AuthInfoRefresh(allAuth map[string]ClientAuth)

客户端权限 刷新

func BroadcastMsg

func BroadcastMsg(msgInput map[string][]byte)

广播数据入口

func GetClientLen

func GetClientLen() (size int)

func GetStatusInfo

func GetStatusInfo() []map[string]interface{}

查询当前客户端状态

Types

type Client

type Client struct {
	// 请求参数
	Param ClientParam
	// 权限
	Auth ClientAuth

	// client连接时取数据
	ClientConnCall func(c *Client) [][]byte
	// 接收client消息
	ClientMsgRecv func(c *Client, message []byte)
	// 广播消息权限过滤
	ClientBroadFilter func(c *Client, item string) bool
	// client断开时回调
	ClientUnRegCall func(param ClientParam)
	// contains filtered or unexported fields
}

func (*Client) Client2Hub

func (c *Client) Client2Hub()

func (*Client) GetRemoteAddr

func (c *Client) GetRemoteAddr() string

func (*Client) SendMessage

func (c *Client) SendMessage(sendMsg []byte)

func (*Client) SetConn

func (c *Client) SetConn(conn *websocket.Conn)

type ClientAuth

type ClientAuth struct {
	UserId     string
	AgencyId   string
	DeptIdList []string
}

type ClientParam

type ClientParam struct {
	Sn           string `json:"sn"`
	DeptId       string `json:"deptId"`
	ProductModel string `json:"productModel"`
	Key          string `json:"key"`
}

type Hub

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

连接池

Jump to

Keyboard shortcuts

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