Documentation
¶
Index ¶
- type OnCloseHandler
- type OnConnectHandler
- type OnErrorHandler
- type OnMessageHandler
- type OnTickHandler
- type ServerOption
- func Address(network, port string) ServerOption
- func IdleTimeout(timeout time.Duration) ServerOption
- func OnCloseHandle(h OnCloseHandler) ServerOption
- func OnConnectHandle(h OnConnectHandler) ServerOption
- func OnMessageHandle(h OnMessageHandler) ServerOption
- func OnTickHandle(h OnTickHandler) ServerOption
- func ReadTimeout(timeout time.Duration) ServerOption
- func StopTimeout(timeout time.Duration) ServerOption
- func TickTime(timeout time.Duration) ServerOption
- func WithLoadBalancing(lb gnet.LoadBalancing) ServerOption
- func WithLogger(logger *zap.Logger) ServerOption
- func WithMaxConn(maxConn int) ServerOption
- type WsCodec
- type WsServer
- func (wss *WsServer) OnBoot(eng gnet.Engine) gnet.Action
- func (wss *WsServer) OnClose(c gnet.Conn, err error) (action gnet.Action)
- func (wss *WsServer) OnOpen(c gnet.Conn) ([]byte, gnet.Action)
- func (wss *WsServer) OnTick() (delay time.Duration, action gnet.Action)
- func (wss *WsServer) OnTraffic(c gnet.Conn) (action gnet.Action)
- func (wss *WsServer) Start()
- func (wss *WsServer) Stop(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OnMessageHandler ¶
OnMessageHandler 收到消息时处理
type ServerOption ¶
type ServerOption func(o *WsServer)
func Address ¶
func Address(network, port string) ServerOption
func OnCloseHandle ¶
func OnCloseHandle(h OnCloseHandler) ServerOption
func OnConnectHandle ¶
func OnConnectHandle(h OnConnectHandler) ServerOption
func OnMessageHandle ¶
func OnMessageHandle(h OnMessageHandler) ServerOption
func OnTickHandle ¶
func OnTickHandle(h OnTickHandler) ServerOption
func WithLoadBalancing ¶
func WithLoadBalancing(lb gnet.LoadBalancing) ServerOption
func WithLogger ¶ added in v0.0.10
func WithLogger(logger *zap.Logger) ServerOption
func WithMaxConn ¶ added in v0.0.6
func WithMaxConn(maxConn int) ServerOption
type WsCodec ¶ added in v0.0.6
type WsCodec struct { Uuid string // 连接的唯一ID // contains filtered or unexported fields }
type WsServer ¶ added in v0.0.6
type WsServer struct { gnet.BuiltinEventEngine // contains filtered or unexported fields }
func Run ¶
func Run(opts ...ServerOption) *WsServer
Click to show internal directories.
Click to hide internal directories.