Documentation ¶
Index ¶
- type After
- type Before
- type Conn
- func (c *Conn) ClientIP() string
- func (c *Conn) Close() error
- func (c *Conn) Emit(pack socket.Pack) error
- func (c *Conn) Host() string
- func (c *Conn) JsonEmit(msg socket.JsonPack) error
- func (c *Conn) Ping() error
- func (c *Conn) Pong() error
- func (c *Conn) ProtoBufEmit(msg socket.ProtoBufPack) error
- func (c *Conn) Push(msg []byte) error
- func (c *Conn) Write(messageType int, msg []byte) (int, error)
- type Middle
- type RouteHandler
- type Router
- type Server
- func (s *Server) Close(fd int64) error
- func (s *Server) Emit(fd int64, pack socket.Pack) error
- func (s *Server) EmitAll(pack socket.Pack) (int, int)
- func (s *Server) GetConnection(fd int64) (*Conn, bool)
- func (s *Server) GetConnections() chan *Conn
- func (s *Server) GetConnectionsCount() int
- func (s *Server) GetRouter() *Router
- func (s *Server) JsonEmit(fd int64, pack socket.JsonPack) error
- func (s *Server) JsonEmitAll(pack socket.JsonPack) (int, int)
- func (s *Server) LocalAddr() net.Addr
- func (s *Server) ProtoBufEmit(fd int64, pack socket.ProtoBufPack) error
- func (s *Server) ProtoBufEmitAll(msg socket.ProtoBufPack) (int, int)
- func (s *Server) Push(fd int64, msg []byte) error
- func (s *Server) Ready()
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetRouter(router *Router) *Server
- func (s *Server) Shutdown() error
- func (s *Server) Start()
- func (s *Server) Use(middle ...func(next Middle) Middle)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { Name string FD int64 Conn *websocket.Conn LastPing time.Time Server *Server Response http.ResponseWriter Request *http.Request // contains filtered or unexported fields }
func (*Conn) ProtoBufEmit ¶
func (c *Conn) ProtoBufEmit(msg socket.ProtoBufPack) error
type RouteHandler ¶
type RouteHandler struct {
// contains filtered or unexported fields
}
func (*RouteHandler) Remove ¶
func (rh *RouteHandler) Remove(path ...string)
func (*RouteHandler) Route ¶
func (rh *RouteHandler) Route(path ...string) *route
type Router ¶
type Router struct { StrictMode bool // contains filtered or unexported fields }
func (*Router) GetAllRouters ¶
func (r *Router) GetAllRouters() []*node
func (*Router) SetGlobalAfter ¶
func (*Router) SetGlobalBefore ¶
type Server ¶
type Server struct { Name string // Host 服务Host Addr string // TLS FILE CertFile string // TLS KEY KeyFile string OnOpen func(conn *Conn) OnMessage func(conn *Conn, msg []byte) OnClose func(conn *Conn) OnError func(err error) OnSuccess func() OnUnknown func(conn *Conn, message []byte, next Middle) HeartBeatTimeout time.Duration HeartBeatInterval time.Duration HandshakeTimeout time.Duration ReadBufferSize int WriteBufferSize int CheckOrigin func(r *http.Request) bool PingHandler func(conn *Conn) func(appData string) error PongHandler func(conn *Conn) func(appData string) error Protocol websocket2.Protocol // contains filtered or unexported fields }
func (*Server) GetConnections ¶
func (*Server) GetConnectionsCount ¶
func (*Server) ProtoBufEmit ¶
func (s *Server) ProtoBufEmit(fd int64, pack socket.ProtoBufPack) error
func (*Server) ProtoBufEmitAll ¶
func (s *Server) ProtoBufEmitAll(msg socket.ProtoBufPack) (int, int)
Click to show internal directories.
Click to hide internal directories.