Documentation ¶
Index ¶
- type After
- type Before
- type Middle
- type RouteHandler
- type Router
- type Server
- func (socket *Server) CheckPath(p1 string, p2 string) bool
- func (socket *Server) Close(fd uint32) error
- func (socket *Server) Emit(fd uint32, event []byte, body []byte, dataType int, protoType int) exception.Error
- func (socket *Server) EmitAll(event []byte, body []byte, dataType int, protoType int) (int, int)
- func (socket *Server) GetConnection(fd uint32) (*WebSocket, bool)
- func (socket *Server) GetConnections() chan *WebSocket
- func (socket *Server) GetConnectionsCount() uint32
- func (socket *Server) GetRouter() *Router
- func (socket *Server) Json(fd uint32, msg lemo.JsonPackage) exception.Error
- func (socket *Server) JsonAll(msg lemo.JsonPackage) (int, int)
- func (socket *Server) JsonEmit(fd uint32, msg lemo.JsonPackage) exception.Error
- func (socket *Server) JsonEmitAll(msg lemo.JsonPackage) (int, int)
- func (socket *Server) LocalAddr() net.Addr
- func (socket *Server) ProtoBufEmit(fd uint32, msg lemo.ProtoBufPackage) exception.Error
- func (socket *Server) ProtoBufEmitAll(msg lemo.ProtoBufPackage) (int, int)
- func (socket *Server) Push(fd uint32, messageType int, msg []byte) exception.Error
- func (socket *Server) Ready()
- func (socket *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (socket *Server) SetRouter(router *Router) *Server
- func (socket *Server) Shutdown()
- func (socket *Server) Start()
- func (socket *Server) Use(middle ...func(next Middle) Middle)
- type WebSocket
- func (conn *WebSocket) ClientIP() string
- func (conn *WebSocket) Close() error
- func (conn *WebSocket) Emit(event []byte, body []byte, dataType int, protoType int) exception.Error
- func (conn *WebSocket) Host() string
- func (conn *WebSocket) Json(msg lemo.JsonPackage) exception.Error
- func (conn *WebSocket) JsonEmit(msg lemo.JsonPackage) exception.Error
- func (conn *WebSocket) ProtoBufEmit(msg lemo.ProtoBufPackage) exception.Error
- func (conn *WebSocket) Push(messageType int, msg []byte) exception.Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middle ¶
type Middle func(conn *WebSocket, 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
type Server ¶
type Server struct { // Host 服务Host Name string Host string // Port 服务端口 Port int // IP IP string // Protocol 协议 TLS bool // TLS FILE CertFile string // TLS KEY KeyFile string AutoBind bool OnClose func(conn *WebSocket) OnMessage func(conn *WebSocket, messageType int, msg []byte) OnOpen func(conn *WebSocket) OnError func(err exception.Error) OnSuccess func() HeartBeatTimeout int HeartBeatInterval int HandshakeTimeout int ReadBufferSize int WriteBufferSize int WaitQueueSize int CheckOrigin func(r *http.Request) bool Path string PingHandler func(connection *WebSocket) func(appData string) error PongHandler func(connection *WebSocket) func(appData string) error Protocol websocket2.Protocol // contains filtered or unexported fields }
func (*Server) GetConnections ¶
func (*Server) GetConnectionsCount ¶
func (*Server) JsonEmitAll ¶
func (socket *Server) JsonEmitAll(msg lemo.JsonPackage) (int, int)
func (*Server) ProtoBufEmit ¶
func (*Server) ProtoBufEmitAll ¶
func (socket *Server) ProtoBufEmitAll(msg lemo.ProtoBufPackage) (int, int)
type WebSocket ¶
type WebSocket struct { FD uint32 Conn *websocket.Conn Server *Server Response http.ResponseWriter Request *http.Request Context lemo.Context }
WebSocket WebSocket
func (*WebSocket) ProtoBufEmit ¶
func (conn *WebSocket) ProtoBufEmit(msg lemo.ProtoBufPackage) exception.Error
Click to show internal directories.
Click to hide internal directories.