Documentation
¶
Overview ¶
@Title WebsocketDealer.go @Description 实现websocket低成本call 需要客户端配合 @Author Dorbmon
Index ¶
- Constants
- Variables
- func InitWebsocketDealer()
- type Conn
- type ConnectData
- type Ranger
- type Replier
- type Session
- type StandardCall
- type StandardReply
- type WebsocketDealFunction
- type WebsocketDealer
- func (z *WebsocketDealer) BindFunction(FunctionName string, Function WebsocketDealFunction) error
- func (z *WebsocketDealer) BindReplyId(id uint64, c chan StandardReply)
- func (z *WebsocketDealer) BroadCast(ranger Ranger) error
- func (z *WebsocketDealer) BroadCastIdRange(ranger Ranger, ids []uint64) error
- func (z *WebsocketDealer) Handler(context *RWeb.Context)
- func (z *WebsocketDealer) RemoveBindReplyId(id uint64)
- type WebsocketResponse
Constants ¶
View Source
const ( ModuleName = "WebsocketDealer" ModuleVersion = 0.2 )
View Source
const (
EventNewConnection = iota
)
View Source
const EventNum = 1
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 Ranger ¶ added in v0.0.12
type Ranger func(data *ConnectData, replier *Replier) error
type Replier ¶ added in v0.0.4
type Replier struct {
// contains filtered or unexported fields
}
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 StandardReply struct {
Id uint64 `json:"id"`
Data interface{} `json:"data"`
}
type WebsocketDealFunction ¶
type WebsocketDealer ¶
type WebsocketDealer struct {
OriginCheck func(ctx *RWeb.Context) bool
Events event.System
// contains filtered or unexported fields
}
func New ¶
func New() (r WebsocketDealer)
func (*WebsocketDealer) BindFunction ¶
func (z *WebsocketDealer) BindFunction(FunctionName string, Function WebsocketDealFunction) error
func (*WebsocketDealer) BindReplyId ¶ added in v0.0.4
func (z *WebsocketDealer) BindReplyId(id uint64, c chan StandardReply)
func (*WebsocketDealer) BroadCast ¶ added in v0.0.12
func (z *WebsocketDealer) BroadCast(ranger Ranger) error
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)
*
使用此函数作为引擎的绑定函数
func (*WebsocketDealer) RemoveBindReplyId ¶ added in v0.0.4
func (z *WebsocketDealer) RemoveBindReplyId(id uint64)
type WebsocketResponse ¶ added in v0.0.4
type WebsocketResponse struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.