wsmodule

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WSCfg

type WSCfg struct {
	ListenAddr      string
	MaxConnNum      int
	PendingWriteNum int
	MaxMsgLen       uint32
	LittleEndian    bool //是否小端序
}

type WSClient

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

func (*WSClient) GetId

func (wc *WSClient) GetId() string

func (*WSClient) OnClose

func (wc *WSClient) OnClose()

func (*WSClient) Run

func (wc *WSClient) Run()

type WSModule

type WSModule struct {
	service.Module
	// contains filtered or unexported fields
}

func (*WSModule) Close

func (ws *WSModule) Close(clientId string)

func (*WSModule) GetClientIp

func (ws *WSModule) GetClientIp(clientId string) string

func (*WSModule) GetProcessor

func (ws *WSModule) GetProcessor() processor.IRawProcessor

func (*WSModule) Init

func (ws *WSModule) Init(wsCfg *WSCfg, process processor.IRawProcessor)

func (*WSModule) NewWSClient

func (ws *WSModule) NewWSClient(conn *network.WSConn) network.Agent

func (*WSModule) OnInit

func (ws *WSModule) OnInit() error

func (*WSModule) SendMsg

func (ws *WSModule) SendMsg(clientId string, msg interface{}) error

func (*WSModule) SendRawMsg

func (ws *WSModule) SendRawMsg(clientId string, msg []byte) error

func (*WSModule) Start

func (ws *WSModule) Start() error

type WSPack

type WSPack struct {
	Type         WSPackType //0表示连接 1表示断开 2表示数据
	MsgProcessor processor.IRawProcessor
	ClientId     string
	Data         any
}

type WSPackType

type WSPackType int8
const (
	WPTConnected    WSPackType = 0
	WPTDisConnected WSPackType = 1
	WPTPack         WSPackType = 2
	WPTUnknownPack  WSPackType = 3
)

Jump to

Keyboard shortcuts

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