Documentation
¶
Index ¶
- type After
- type Before
- type Client
- func (client *Client) Close() error
- func (client *Client) Connect()
- func (client *Client) Emit(event []byte, body []byte, dataType int, protoType int) exception.Error
- func (client *Client) GetRouter() *Router
- func (client *Client) Json(msg lemo.JsonPackage) exception.Error
- func (client *Client) JsonEmit(msg lemo.JsonPackage) exception.Error
- func (client *Client) LocalAddr() net.Addr
- func (client *Client) ProtoBufEmit(msg lemo.ProtoBufPackage) exception.Error
- func (client *Client) Push(messageType int, message []byte) exception.Error
- func (client *Client) RemoteAddr() net.Addr
- func (client *Client) SetRouter(router *Router) *Client
- func (client *Client) Use(middle ...func(Middle) Middle)
- type Middle
- type RouteHandler
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// 服务器信息
Name string
Scheme string
Host string
IP string
Port int
Path string
// 客户端信息
Conn *websocket.Conn
Response *http.Response
AutoHeartBeat bool
HeartBeatTimeout int
HeartBeatInterval int
HeartBeat func(c *Client) error
Reconnect bool
ReconnectInterval int
WriteBufferSize int
ReadBufferSize int
HandshakeTimeout int
// 消息处理
OnOpen func(c *Client)
OnClose func(c *Client)
OnMessage func(c *Client, messageType int, msg []byte)
OnError func(err exception.Error)
OnSuccess func()
Status bool
Context lemo.Context
PingHandler func(c *Client) func(appData string) error
PongHandler func(c *Client) func(appData string) error
Protocol websocket2.Protocol
// contains filtered or unexported fields
}
func (*Client) ProtoBufEmit ¶
func (client *Client) ProtoBufEmit(msg lemo.ProtoBufPackage) exception.Error
func (*Client) RemoteAddr ¶ added in v1.1.1
type Middle ¶
type Middle func(c *Client, receive *lemo.ReceivePackage)
type RouteHandler ¶
type RouteHandler struct {
// contains filtered or unexported fields
}
func (*RouteHandler) Route ¶
func (handler *RouteHandler) Route(path string) *route
type Router ¶
type Router struct {
IgnoreCase bool
// contains filtered or unexported fields
}
func (*Router) GetAllRouters ¶
func (router *Router) GetAllRouters() []*node
func (*Router) SetGlobalAfter ¶ added in v1.1.1
func (*Router) SetGlobalBefore ¶ added in v1.1.1
Click to show internal directories.
Click to hide internal directories.