rpc_impl

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CALL_TIMEOUT = 10 * time.Second

Variables

View Source
var ErrNoKnow = errors.New("rpc: unknow")
View Source
var ErrTimeOut = errors.New("rpc: timeout")

Functions

func NewServer

func NewServer(client rpc.RPC, serverID string, seqID int32) rpc.Server

Types

type Call

type Call struct {
	Ch  chan *rpcmsg.RPCMessage
	Err error
	// contains filtered or unexported fields
}

type RPCImpl

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

func NewRPC

func NewRPC(ctx context.Context, serverID string, processor processor.Processor, conn *nats.Conn) *RPCImpl

func (*RPCImpl) Call

func (p *RPCImpl) Call(req *rpcmsg.RPCMessage) (resp *rpcmsg.RPCMessage, err error)

阻塞式

func (*RPCImpl) Close

func (r *RPCImpl) Close()

func (*RPCImpl) Push

func (p *RPCImpl) Push(msg *rpcmsg.RPCMessage)

异步发送

func (*RPCImpl) Run

func (r *RPCImpl) Run() (err error)

type SessionImpl

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

func NewSession

func NewSession(uid int, cid, gid string, rpc *RPCImpl) *SessionImpl

func (*SessionImpl) Bind

func (sess *SessionImpl) Bind(uid int) (bool, error)

PushAll 分组推送

func (*SessionImpl) GateID

func (sess *SessionImpl) GateID() string

UID 获取网关

func (*SessionImpl) ID

func (sess *SessionImpl) ID() string

ID 获取连接ID

func (*SessionImpl) Push

func (sess *SessionImpl) Push(data []byte)

Push 发送消息(异步)

func (*SessionImpl) PushAll

func (sess *SessionImpl) PushAll(data []byte)

PushAll 全网关推送

func (*SessionImpl) PushGroup

func (sess *SessionImpl) PushGroup(data []byte, members []string)

PushAll 分组推送

func (*SessionImpl) UID

func (sess *SessionImpl) UID() int

UID 获取用户ID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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