ws

package
v0.0.0-...-d4a31e9 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserConnMap sync.Map

UserConnMap is a sync.Map to store use conn

View Source
var UserConnPool = sync.Pool{New: func() interface{} {
	return new(UserConn)
}}

Functions

This section is empty.

Types

type UserConn

type UserConn struct {
	UserPhone string

	MsgHandler func(*pb.Msg, *UserConn)
	OnClose    func(string) error
	// contains filtered or unexported fields
}

func NewUserConn

func NewUserConn(socket *websocket.Conn) *UserConn

func (*UserConn) Close

func (conn *UserConn) Close()

Close 主动关闭用户连接

func (*UserConn) ResetUserConn

func (conn *UserConn) ResetUserConn(
	socket *websocket.Conn,
	mutex *sync.Mutex,
	closed bool,
	userPhone string)

func (*UserConn) Send

func (conn *UserConn) Send(bs []byte) error

func (*UserConn) StartReadMessage

func (conn *UserConn) StartReadMessage()

Jump to

Keyboard shortcuts

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