wsmodule

package
v1.0.3 Latest Latest
Warning

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

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

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