Documentation ¶
Overview ¶
@Title WebsocketDealer.go @Description 实现websocket低成本call 需要客户端配合 @Author Dorbmon
Index ¶
- Constants
- Variables
- func InitWebsocketDealer()
- type Conn
- type ConnectData
- type NumberPool
- type Ranger
- type Replier
- type Session
- type StandardCall
- type StandardReply
- type WebsocketCallInterceptor
- type WebsocketDealFunction
- type WebsocketDealer
- func (z *WebsocketDealer) AddInterceptor(interceptor WebsocketCallInterceptor)
- func (z *WebsocketDealer) BindFunction(FunctionName string, Function WebsocketDealFunction) error
- func (z *WebsocketDealer) BroadCast(ranger Ranger) error
- func (z *WebsocketDealer) BroadCastIdRange(ranger Ranger, ids []uint64) error
- func (z *WebsocketDealer) Handler(context *RWeb.Context)
- type WebsocketResponse
Constants ¶
View Source
const ( EventNewConnection = iota /* EventNewConnection call with *NewConnectData The caller of NewConnectData won't be collected. */ EventConnectionClose )
View Source
const ( ModuleName = "WebsocketDealer" ModuleVersion = 0.4 )
View Source
const EventNum = 2
Variables ¶
View Source
var NewConnectDataPool = sync.Pool{New: func() interface{} { return new(ConnectData) }}
View Source
var Once sync.Once
Functions ¶
func InitWebsocketDealer ¶ added in v0.0.4
func InitWebsocketDealer()
Types ¶
type ConnectData ¶ added in v0.0.12
type NumberPool ¶ added in v0.0.15
type NumberPool struct {
// contains filtered or unexported fields
}
func NewNumberPool ¶ added in v0.0.15
func NewNumberPool(initNumber uint64) (ret NumberPool)
newNumberPool 生成新的Pool initNumber 初始化的数字数量
func (*NumberPool) Get ¶ added in v0.0.15
func (z *NumberPool) Get() uint64
func (*NumberPool) Put ¶ added in v0.0.15
func (z *NumberPool) Put(num uint64)
type Replier ¶ added in v0.0.4
type Replier struct {
// contains filtered or unexported fields
}
func (*Replier) CallNotWait ¶ added in v0.0.18
CallNotWait 不等待回复
type Session ¶ added in v0.0.12
type Session struct { Data interface{} CreateTime int64 // contains filtered or unexported fields }
func NewSession ¶ added in v0.0.12
func NewSession() *Session
type StandardCall ¶
type StandardReply ¶ added in v0.0.4
type WebsocketCallInterceptor ¶ added in v0.0.19
type WebsocketDealFunction ¶
type WebsocketDealFunction interface{}
type WebsocketDealer ¶
type WebsocketDealer struct { OriginCheck func(ctx *RWeb.Context) bool Events event.System // contains filtered or unexported fields }
func (*WebsocketDealer) AddInterceptor ¶ added in v0.0.19
func (z *WebsocketDealer) AddInterceptor(interceptor WebsocketCallInterceptor)
AddInterceptor 添加拦截器0
func (*WebsocketDealer) BindFunction ¶
func (z *WebsocketDealer) BindFunction(FunctionName string, Function WebsocketDealFunction) error
BindFunction 绑定函数
func (*WebsocketDealer) BroadCast ¶ added in v0.0.12
func (z *WebsocketDealer) BroadCast(ranger Ranger) error
BroadCast 广播
func (*WebsocketDealer) BroadCastIdRange ¶ added in v0.0.12
func (z *WebsocketDealer) BroadCastIdRange(ranger Ranger, ids []uint64) error
func (*WebsocketDealer) Handler ¶
func (z *WebsocketDealer) Handler(context *RWeb.Context)
*
使用此函数作为引擎的绑定函数
type WebsocketResponse ¶ added in v0.0.4
Click to show internal directories.
Click to hide internal directories.