websocket

package
v0.0.0-...-40a94d4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SocketStart

func SocketStart()

Types

type Client

type Client struct {
	Addr   string
	Socket *websocket.Conn

	AppID         uint32
	UserID        uint
	FirstTime     time.Time
	HeartbeatTime time.Time
	LoginTime     time.Time
	// contains filtered or unexported fields
}

func CreateClient

func CreateClient(addr string, socket *websocket.Conn) *Client

func (*Client) Read

func (c *Client) Read()

func (*Client) Write

func (c *Client) Write()

type ClientManager

type ClientManager struct {
	Client      map[*Client]bool   //全部的连接
	ClientsLock sync.RWMutex       //读写锁
	Users       map[string]*Client //登陆的用户 //appID+uuid
	UsersLock   sync.RWMutex       //读写锁
	Connect     chan *Client       //连接处理
	Disconnect  chan *Client       //断开连接处理
	Login       chan *Client       //用户登录处理
	Broadcast   chan *Client       //广播 向全部成员发送数据
}

func NewClientManager

func NewClientManager() *ClientManager

Jump to

Keyboard shortcuts

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