server

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	gnet.Conn
	session.BaseConn
	// contains filtered or unexported fields
}

func (*Conn) AsyncWrite

func (conn *Conn) AsyncWrite(buf []byte, callback func(c session.Conn, err error) error) (err error)

func (*Conn) AsyncWritev

func (conn *Conn) AsyncWritev(bs [][]byte, callback func(c session.Conn, err error) error) (err error)

func (*Conn) Init

func (conn *Conn) Init(gConn gnet.Conn) error

type Option

type Option func(options *Options)

func WithCheckSessionInterval added in v0.0.4

func WithCheckSessionInterval(value time.Duration) Option

func WithGNetOption

func WithGNetOption(options ...gnet.Option) Option

func WithUnregisterSessionLife added in v0.0.4

func WithUnregisterSessionLife(value int64) Option

type Options

type Options struct {
	GNetOptions gnet.Options
	// 未注册session的存活时间,单位秒
	UnregisterSessionLife int64
	// 检查session间隔
	CheckSessionInterval time.Duration
}

func NewOptions

func NewOptions(opts ...Option) (*Options, error)

NewOptions

@Description: 创建 Options
@param opts
@return Options

type Server

type Server struct {
	*session.Manager
	// contains filtered or unexported fields
}

func NewServer

func NewServer(name string, protoAddr string,
	codec message.Codec, listener session.Listener, opts ...Option) (server *Server, err error)

func (*Server) Name added in v0.0.4

func (server *Server) Name() string

func (*Server) Start

func (server *Server) Start(ctx context.Context) error

func (*Server) Stop

func (server *Server) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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