processor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PPRO_TCP_LTV = "tcp.ltv"
	PPRO_UDP_LTV = "udp.ltv"
	PPRO_WS_LTV  = "ws.ltv"
	PPRO_HTTP    = "http"
)

Variables

This section is empty.

Functions

func BindProcessorHandler

func BindProcessorHandler(peer void.Peer, name string, userCallback void.EventHandler, args ...interface{})

func NewEventQueue

func NewEventQueue() void.EventQueue

func NewProcessor

func NewProcessor() void.Processor

func NewQueuedEventCallback

func NewQueuedEventCallback(callback void.EventHandler) void.EventHandler

让EventCallback保证放在 session 的队列里,而不是并发的

func QueuedCall

func QueuedCall(queue void.EventQueue, callback func())

有队列时队列调用,无队列时直接调用

func Register

func Register(name string, f ProcessorBinder)

func SessionQueuedCall

func SessionQueuedCall(s void.Session, callback func())

在会话对应的Peer上的事件队列中执行callback,如果没有队列,则马上执行

Types

type ProcessorBinder

type ProcessorBinder func(bundle void.Processor, userCallback void.EventHandler, args ...interface{})

type RecvEvent

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

接受到消息

func NewRecvEvent

func NewRecvEvent(s void.Session, m interface{}) *RecvEvent

func (*RecvEvent) Message

func (r *RecvEvent) Message() interface{}

func (*RecvEvent) Send

func (r *RecvEvent) Send(msg interface{})

func (*RecvEvent) Session

func (r *RecvEvent) Session() void.Session

type SendEvent

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

会话开始发送数据事件

func NewSendEvent

func NewSendEvent(s void.Session, m interface{}) *SendEvent

func (*SendEvent) Message

func (s *SendEvent) Message() interface{}

func (*SendEvent) Session

func (s *SendEvent) Session() void.Session

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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