PPMQConnect

package
v0.0.0-...-88f3d6a Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CmdID   uint64 = 12
	CmdName string = "PPMQConnect"
	Module  string = "ppmqd"
)

Variables

This section is empty.

Functions

func RegisterPPRpcServer

func RegisterPPRpcServer(s *grpc.Server, srv PPRpcServer)

func RegisterService

func RegisterService(s *pprpc.Service, hook Rpcer)

RegisterService 注册服务

Types

type PPMQConnectClient

type PPMQConnectClient interface {
	PPCall(ctx context.Context, in *Req) (*Resp, *packets.CmdPacket, error)
}

func NewPPMQConnectClient

func NewPPMQConnectClient(cc pprpc.RPCCliConn) PPMQConnectClient

type PPRpcClient

type PPRpcClient interface {
	PCall(ctx context.Context, in *Req, opts ...grpc.CallOption) (*Resp, error)
}

PPRpcClient is the client API for PPRpc service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewPPRpcClient

func NewPPRpcClient(cc *grpc.ClientConn) PPRpcClient

type PPRpcServer

type PPRpcServer interface {
	PCall(context.Context, *Req) (*Resp, error)
}

PPRpcServer is the server API for PPRpc service.

type Req

type Req struct {
	Account  string `protobuf:"bytes,1,opt,name=account,proto3" json:"account"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password"`
	ClientId string `protobuf:"bytes,3,opt,name=client_id,json=clientId,proto3" json:"client_id"`
	// 当前连接是否需要获取离线记录; 1 不获取,只用于接收新消息; 2 只用于获取离线消息; 3 同时获取新消息和离线消息.
	HistorymsgType int32 `protobuf:"varint,4,opt,name=historymsg_type,json=historymsgType,proto3" json:"historymsg_type"`
	// 可以设定获取离线消息的数量,默认是5条;0 表示获取所有(historymsg_type = 2,3)
	HistorymsgCount int32 `protobuf:"varint,5,opt,name=historymsg_count,json=historymsgCount,proto3" json:"historymsg_count"`
	// 0: 表示记录该ClientID的订阅信息以及服务QOS1,2的消息,在该ClientID上线后再推送该消息给对方.
	// 1: 会话仅仅维持当前连接(订阅信息会清除)
	ClearSession int32 `protobuf:"varint,6,opt,name=clear_session,json=clearSession,proto3" json:"clear_session"`
	// 1:发布一条遗嘱消息
	WillFlag uint32 `protobuf:"varint,9,opt,name=will_flag,json=willFlag,proto3" json:"will_flag"`
	// 遗嘱消息的QOS
	WillQos uint32 `protobuf:"varint,10,opt,name=will_qos,json=willQos,proto3" json:"will_qos"`
	// 是否保留遗嘱消息.1 当作保留信息发布;0 非保留信息发布.
	WillRetain uint32 `protobuf:"varint,11,opt,name=will_retain,json=willRetain,proto3" json:"will_retain"`
	// 遗嘱主题/消息
	WillTopic            string   `protobuf:"bytes,12,opt,name=will_topic,json=willTopic,proto3" json:"will_topic"`
	WillBody             string   `protobuf:"bytes,13,opt,name=will_body,json=willBody,proto3" json:"will_body"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Reqest

func (*Req) Descriptor

func (*Req) Descriptor() ([]byte, []int)

func (*Req) GetAccount

func (m *Req) GetAccount() string

func (*Req) GetClearSession

func (m *Req) GetClearSession() int32

func (*Req) GetClientId

func (m *Req) GetClientId() string

func (*Req) GetHistorymsgCount

func (m *Req) GetHistorymsgCount() int32

func (*Req) GetHistorymsgType

func (m *Req) GetHistorymsgType() int32

func (*Req) GetPassword

func (m *Req) GetPassword() string

func (*Req) GetWillBody

func (m *Req) GetWillBody() string

func (*Req) GetWillFlag

func (m *Req) GetWillFlag() uint32

func (*Req) GetWillQos

func (m *Req) GetWillQos() uint32

func (*Req) GetWillRetain

func (m *Req) GetWillRetain() uint32

func (*Req) GetWillTopic

func (m *Req) GetWillTopic() string

func (*Req) ProtoMessage

func (*Req) ProtoMessage()

func (*Req) Reset

func (m *Req) Reset()

func (*Req) String

func (m *Req) String() string

func (*Req) XXX_DiscardUnknown

func (m *Req) XXX_DiscardUnknown()

func (*Req) XXX_Marshal

func (m *Req) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Req) XXX_Merge

func (m *Req) XXX_Merge(src proto.Message)

func (*Req) XXX_Size

func (m *Req) XXX_Size() int

func (*Req) XXX_Unmarshal

func (m *Req) XXX_Unmarshal(b []byte) error

type Resp

type Resp struct {
	// 0 : 如果连接使用的TCP则使用请求时的值作为心跳间隔;如果是UDP则自动探测UDP的生存时间.
	// 1-65535: TCP/UDP, 使用返回的值作为心跳间隔;
	HbInterval uint32 `protobuf:"varint,11,opt,name=hb_interval,json=hbInterval,proto3" json:"hb_interval"`
	// 连接确认标志(参见MQTT的 CONNACK的说明)
	Sp uint32 `protobuf:"varint,12,opt,name=sp,proto3" json:"sp"`
	// 参见MQTT的CONNACK的返回码定义
	Code                 uint32   `protobuf:"varint,13,opt,name=code,proto3" json:"code"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Response

func (*Resp) Descriptor

func (*Resp) Descriptor() ([]byte, []int)

func (*Resp) GetCode

func (m *Resp) GetCode() uint32

func (*Resp) GetHbInterval

func (m *Resp) GetHbInterval() uint32

func (*Resp) GetSp

func (m *Resp) GetSp() uint32

func (*Resp) ProtoMessage

func (*Resp) ProtoMessage()

func (*Resp) Reset

func (m *Resp) Reset()

func (*Resp) String

func (m *Resp) String() string

func (*Resp) XXX_DiscardUnknown

func (m *Resp) XXX_DiscardUnknown()

func (*Resp) XXX_Marshal

func (m *Resp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Resp) XXX_Merge

func (m *Resp) XXX_Merge(src proto.Message)

func (*Resp) XXX_Size

func (m *Resp) XXX_Size() int

func (*Resp) XXX_Unmarshal

func (m *Resp) XXX_Unmarshal(b []byte) error

type Rpcer

type Rpcer interface {
	ReqHandle(c pprpc.RPCConn, pkg *packets.CmdPacket, req *Req) (err error)
	RespHandle(c pprpc.RPCConn, pkg *packets.CmdPacket, resp *Resp) (err error)
	DestructHandle(c pprpc.RPCConn, pkg *packets.CmdPacket, startMs int64)
}

Jump to

Keyboard shortcuts

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