server

package
v0.0.0-...-aed9a31 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *Options)

func WithClusterName

func WithClusterName(name string) Option

type Options

type Options struct {
	NatsAddr string // nats://127.0.0.1:4222,nats://127.0.0.1:4223
	User     string // 用户名
	Pwd      string // 密码

	ConsulAddr string
	Server     discovery.ServiceInstance
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, serverID string, pro processor.Processor, opt *Options) *Server

func (*Server) Close

func (p *Server) Close()

func (*Server) GetServerByID

func (p *Server) GetServerByID(serverID string) rpc.Server

func (*Server) GetServerByKind

func (p *Server) GetServerByKind(kind string) (s rpc.Server)

多个服务 返回随机找到的第一个

func (*Server) RegisterServerMsgHandler

func (g *Server) RegisterServerMsgHandler(msgID string, handle func(rpc.Server, *rpcmsg.RPCMessage))

func (*Server) Run

func (p *Server) Run(watch ...string) error

func (*Server) SetOnSessionDisconnect

func (p *Server) SetOnSessionDisconnect(f func(gateID, CID string, uid int))

func (*Server) WatchService

func (r *Server) WatchService(serverNames []string) error

Jump to

Keyboard shortcuts

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