ws

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WsErrConnLoss = errors.New("conn already close")
)

Functions

func ClientIP

func ClientIP(c *http.Request) string

func GetWsCenter

func GetWsCenter() *wsCenter

func InitWsServer

func InitWsServer()

func NewWsCenter

func NewWsCenter(maxConn int32)

Types

type WsConnection

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

func NewWsConnection

func NewWsConnection(conn *websocket.Conn) *WsConnection

func (*WsConnection) GetIp

func (w *WsConnection) GetIp() string

func (*WsConnection) GetUid

func (w *WsConnection) GetUid() uint32

func (*WsConnection) GetWsId

func (w *WsConnection) GetWsId() string

func (*WsConnection) ReadMsg

func (w *WsConnection) ReadMsg() (message interface{}, err error)

func (*WsConnection) SendMsg

func (w *WsConnection) SendMsg(msg interface{}) (err error)

func (*WsConnection) SetIp

func (w *WsConnection) SetIp(ip string)

func (*WsConnection) SetUid

func (w *WsConnection) SetUid(uid uint32)

Jump to

Keyboard shortcuts

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