server

package
v1.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type After added in v1.1.1

type After func(conn *Socket, receive *lemo.Receive) exception.Error

type Before added in v1.1.1

type Before func(conn *Socket, receive *lemo.Receive) (lemo.Context, exception.Error)

type Middle

type Middle func(conn *Socket, 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) Group

func (router *Router) Group(path ...string) *group

func (*Router) Route

func (router *Router) Route(path string) *route

func (*Router) SetGlobalAfter added in v1.1.1

func (router *Router) SetGlobalAfter(after ...After)

func (*Router) SetGlobalBefore added in v1.1.1

func (router *Router) SetGlobalBefore(before ...Before)

type Server

type Server struct {
	Name      string
	Host      string
	Port      int
	IP        string
	AutoBind  bool
	OnClose   func(conn *Socket)
	OnMessage func(conn *Socket, messageType int, msg []byte)
	OnOpen    func(conn *Socket)
	OnError   func(err exception.Error)
	OnSuccess func()

	HeartBeatTimeout  int
	HeartBeatInterval int
	ReadBufferSize    int
	WriteBufferSize   int
	WaitQueueSize     int
	HandshakeTimeout  int

	PingHandler func(connection *Socket) func(appData string) error

	PongHandler func(connection *Socket) func(appData string) error

	Protocol tcp.Protocol
	// contains filtered or unexported fields
}

func (*Server) Close

func (socket *Server) Close(fd uint32) error

func (*Server) Emit

func (socket *Server) Emit(fd uint32, event []byte, body []byte, dataType int, protoType int) exception.Error

func (*Server) EmitAll

func (socket *Server) EmitAll(event []byte, body []byte, dataType int, protoType int) (int, int)

func (*Server) GetConnection

func (socket *Server) GetConnection(fd uint32) (*Socket, bool)

func (*Server) GetConnections

func (socket *Server) GetConnections() chan *Socket

func (*Server) GetConnectionsCount

func (socket *Server) GetConnectionsCount() uint32

func (*Server) GetRouter

func (socket *Server) GetRouter() *Router

func (*Server) JsonEmit

func (socket *Server) JsonEmit(fd uint32, msg lemo.JsonPackage) exception.Error

func (*Server) JsonEmitAll

func (socket *Server) JsonEmitAll(msg lemo.JsonPackage) (int, int)

func (*Server) LocalAddr added in v1.1.1

func (socket *Server) LocalAddr() net.Addr

func (*Server) ProtoBufEmit

func (socket *Server) ProtoBufEmit(fd uint32, msg lemo.ProtoBufPackage) exception.Error

func (*Server) ProtoBufEmitAll

func (socket *Server) ProtoBufEmitAll(msg lemo.ProtoBufPackage) (int, int)

func (*Server) Push

func (socket *Server) Push(fd uint32, msg []byte) exception.Error

Push 发送消息

func (*Server) Ready

func (socket *Server) Ready()

func (*Server) SetRouter

func (socket *Server) SetRouter(router *Router) *Server

func (*Server) Shutdown

func (socket *Server) Shutdown()

func (*Server) Start

func (socket *Server) Start()

func (*Server) Use

func (socket *Server) Use(middle ...func(Middle) Middle)

type Socket

type Socket struct {
	FD      uint32
	Conn    net.Conn
	Server  *Server
	Context lemo.Context
}

func (*Socket) ClientIP

func (conn *Socket) ClientIP() string

func (*Socket) Close

func (conn *Socket) Close() error

func (*Socket) Emit

func (conn *Socket) Emit(event []byte, body []byte, dataType int, protoType int) exception.Error

func (*Socket) Host added in v1.1.1

func (conn *Socket) Host() string

func (*Socket) JsonEmit

func (conn *Socket) JsonEmit(msg lemo.JsonPackage) exception.Error

func (*Socket) ProtoBufEmit

func (conn *Socket) ProtoBufEmit(msg lemo.ProtoBufPackage) exception.Error

func (*Socket) Push

func (conn *Socket) Push(msg []byte) exception.Error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL