wsservice

package
v0.0.0-...-1905027 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxNodeId = 1<<14 - 1 //最大值 16383
	MaxSeed   = 1<<19 - 1 //最大值 524287
	MaxTime   = 1<<31 - 1 //最大值 2147483647
)
View Source
const Default_WS_MaxConnNum = 3000
View Source
const Default_WS_MaxMsgLen = 65535
View Source
const Default_WS_PendingWriteNum = 10000

Variables

This section is empty.

Functions

This section is empty.

Types

type WSClient

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

func (*WSClient) GetId

func (slf *WSClient) GetId() uint64

func (*WSClient) OnClose

func (slf *WSClient) OnClose()

func (*WSClient) Run

func (slf *WSClient) Run()

type WSPack

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

type WSPackType

type WSPackType int8
const (
	WPT_Connected    WSPackType = 0
	WPT_DisConnected WSPackType = 1
	WPT_Pack         WSPackType = 2
	WPT_UnknownPack  WSPackType = 3
)

type WSService

type WSService struct {
	service.Service
	// contains filtered or unexported fields
}

func (*WSService) Close

func (ws *WSService) Close(clientid uint64)

func (*WSService) NewWSClient

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

func (*WSService) OnInit

func (ws *WSService) OnInit() error

func (*WSService) SendMsg

func (ws *WSService) SendMsg(clientid uint64, msg interface{}) error

func (*WSService) SetMessageType

func (ws *WSService) SetMessageType(messageType int)

func (*WSService) SetProcessor

func (ws *WSService) SetProcessor(process processor.IProcessor, handler event.IEventHandler)

func (*WSService) WSEventHandler

func (ws *WSService) WSEventHandler(ev event.IEvent)

Jump to

Keyboard shortcuts

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