Documentation
¶
Overview ¶
Package msgpb is a generated protocol buffer package.
It is generated from these files:
github.com/molon/gomsg/pb/msgpb/msg.proto
It has these top-level messages:
Ack Ping Pong SubRoomRequest CommonResponse ClientPayload ServerPayload Message MessagesWrapper
Index ¶
- Variables
- func RegisterMsgServer(s *grpc.Server, srv MsgServer)
- type Ack
- type ClientPayload
- func (*ClientPayload) Descriptor() ([]byte, []int)
- func (m *ClientPayload) GetAck() *Ack
- func (m *ClientPayload) GetBody() isClientPayload_Body
- func (m *ClientPayload) GetPing() *Ping
- func (m *ClientPayload) GetSeq() string
- func (m *ClientPayload) GetSub() *SubRoomRequest
- func (*ClientPayload) ProtoMessage()
- func (m *ClientPayload) Reset()
- func (m *ClientPayload) String() string
- func (*ClientPayload) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type ClientPayload_Ack
- type ClientPayload_Ping
- type ClientPayload_Sub
- type CommonResponse
- type Message
- type MessageOption
- type MessagesWrapper
- type MsgClient
- type MsgServer
- type Msg_LoopV1Client
- type Msg_LoopV1Server
- type Ping
- type Pong
- type ServerPayload
- func (*ServerPayload) Descriptor() ([]byte, []int)
- func (m *ServerPayload) GetBody() isServerPayload_Body
- func (m *ServerPayload) GetMsgsWrapper() *MessagesWrapper
- func (m *ServerPayload) GetNeedAck() bool
- func (m *ServerPayload) GetPong() *Pong
- func (m *ServerPayload) GetSeq() string
- func (m *ServerPayload) GetSubResp() *CommonResponse
- func (*ServerPayload) ProtoMessage()
- func (m *ServerPayload) Reset()
- func (m *ServerPayload) String() string
- func (*ServerPayload) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type ServerPayload_MsgsWrapper
- type ServerPayload_Pong
- type ServerPayload_SubResp
- type SubRoomRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var MessageOption_name = map[int32]string{
0: "NONE",
1: "NEED_ACK",
2: "NEED_OFFLINE",
4: "NEED_NOTIFICATION",
}
View Source
var MessageOption_value = map[string]int32{
"NONE": 0,
"NEED_ACK": 1,
"NEED_OFFLINE": 2,
"NEED_NOTIFICATION": 4,
}
Functions ¶
func RegisterMsgServer ¶
Types ¶
type Ack ¶
type Ack struct {
Seq string `protobuf:"bytes,1,opt,name=seq" json:"seq,omitempty"`
}
Ack反馈消息
func (*Ack) Descriptor ¶
func (*Ack) ProtoMessage ¶
func (*Ack) ProtoMessage()
type ClientPayload ¶
type ClientPayload struct {
// 唯一标识,由客户端生成,一般仅留作ack或者resp使用
Seq string `protobuf:"bytes,1,opt,name=seq" json:"seq,omitempty"`
// Types that are valid to be assigned to Body:
// *ClientPayload_Ack
// *ClientPayload_Ping
// *ClientPayload_Sub
Body isClientPayload_Body `protobuf_oneof:"Body"`
}
客户端发送给loop端
func (*ClientPayload) Descriptor ¶
func (*ClientPayload) Descriptor() ([]byte, []int)
func (*ClientPayload) GetAck ¶
func (m *ClientPayload) GetAck() *Ack
func (*ClientPayload) GetBody ¶
func (m *ClientPayload) GetBody() isClientPayload_Body
func (*ClientPayload) GetPing ¶
func (m *ClientPayload) GetPing() *Ping
func (*ClientPayload) GetSeq ¶
func (m *ClientPayload) GetSeq() string
func (*ClientPayload) GetSub ¶
func (m *ClientPayload) GetSub() *SubRoomRequest
func (*ClientPayload) ProtoMessage ¶
func (*ClientPayload) ProtoMessage()
func (*ClientPayload) Reset ¶
func (m *ClientPayload) Reset()
func (*ClientPayload) String ¶
func (m *ClientPayload) String() string
func (*ClientPayload) XXX_OneofFuncs ¶
func (*ClientPayload) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type ClientPayload_Ack ¶
type ClientPayload_Ack struct {
Ack *Ack `protobuf:"bytes,11,opt,name=ack,oneof"`
}
type ClientPayload_Ping ¶
type ClientPayload_Ping struct {
Ping *Ping `protobuf:"bytes,12,opt,name=ping,oneof"`
}
type ClientPayload_Sub ¶
type ClientPayload_Sub struct {
Sub *SubRoomRequest `protobuf:"bytes,13,opt,name=sub,oneof"`
}
type CommonResponse ¶
type CommonResponse struct {
Seq string `protobuf:"bytes,1,opt,name=seq" json:"seq,omitempty"`
Code errorpb.Code `protobuf:"varint,2,opt,name=code,enum=errorpb.Code" json:"code,omitempty"`
Msg string `protobuf:"bytes,3,opt,name=msg" json:"msg,omitempty"`
}
通用反馈,跟对一些后缀为Request的使用
func (*CommonResponse) Descriptor ¶
func (*CommonResponse) Descriptor() ([]byte, []int)
func (*CommonResponse) GetCode ¶
func (m *CommonResponse) GetCode() errorpb.Code
func (*CommonResponse) GetMsg ¶
func (m *CommonResponse) GetMsg() string
func (*CommonResponse) GetSeq ¶
func (m *CommonResponse) GetSeq() string
func (*CommonResponse) ProtoMessage ¶
func (*CommonResponse) ProtoMessage()
func (*CommonResponse) Reset ¶
func (m *CommonResponse) Reset()
func (*CommonResponse) String ¶
func (m *CommonResponse) String() string
type Message ¶
type Message struct {
// 消息唯一标识,一般由station端分发时生成,客户端去重使用以及离线消息存储的依据
Seq string `protobuf:"bytes,1,opt,name=seq" json:"seq,omitempty"`
// 选项
Options MessageOption `protobuf:"varint,2,opt,name=options,enum=msgpb.MessageOption" json:"options,omitempty"`
// 消息体
Body *google_protobuf.Any `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"`
}
消息
func (*Message) Descriptor ¶
func (*Message) GetBody ¶
func (m *Message) GetBody() *google_protobuf.Any
func (*Message) GetOptions ¶
func (m *Message) GetOptions() MessageOption
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
type MessageOption ¶
type MessageOption int32
消息选项
const ( MessageOption_NONE MessageOption = 0 // 1 << 0 需要客户端ack的 MessageOption_NEED_ACK MessageOption = 1 // 1 << 1 客户端不在线则需要存储为离线消息的 MessageOption_NEED_OFFLINE MessageOption = 2 // 1 << 2 客户端不在线则需要投递通知的 (例如apns) MessageOption_NEED_NOTIFICATION MessageOption = 4 )
func (MessageOption) EnumDescriptor ¶
func (MessageOption) EnumDescriptor() ([]byte, []int)
func (MessageOption) String ¶
func (x MessageOption) String() string
type MessagesWrapper ¶
type MessagesWrapper struct {
Msgs []*Message `protobuf:"bytes,1,rep,name=msgs" json:"msgs,omitempty"`
}
消息列表wrapper
func (*MessagesWrapper) Descriptor ¶
func (*MessagesWrapper) Descriptor() ([]byte, []int)
func (*MessagesWrapper) GetMsgs ¶
func (m *MessagesWrapper) GetMsgs() []*Message
func (*MessagesWrapper) ProtoMessage ¶
func (*MessagesWrapper) ProtoMessage()
func (*MessagesWrapper) Reset ¶
func (m *MessagesWrapper) Reset()
func (*MessagesWrapper) String ¶
func (m *MessagesWrapper) String() string
type MsgClient ¶
type MsgClient interface {
// 消息传递通道
LoopV1(ctx context.Context, opts ...grpc.CallOption) (Msg_LoopV1Client, error)
}
func NewMsgClient ¶
func NewMsgClient(cc *grpc.ClientConn) MsgClient
type MsgServer ¶
type MsgServer interface {
// 消息传递通道
LoopV1(Msg_LoopV1Server) error
}
type Msg_LoopV1Client ¶
type Msg_LoopV1Client interface {
Send(*ClientPayload) error
Recv() (*ServerPayload, error)
grpc.ClientStream
}
type Msg_LoopV1Server ¶
type Msg_LoopV1Server interface {
Send(*ServerPayload) error
Recv() (*ClientPayload, error)
grpc.ServerStream
}
type Ping ¶
type Ping struct {
}
心跳,这个是由于一些语言的gRPC skd不支持客户端的keepalive 所以客户端检测服务端存活就需要自行ping,服务端这里简单的返回pong而已
func (*Ping) Descriptor ¶
func (*Ping) ProtoMessage ¶
func (*Ping) ProtoMessage()
type Pong ¶
type Pong struct {
Code errorpb.Code `protobuf:"varint,1,opt,name=code,enum=errorpb.Code" json:"code,omitempty"`
Msg string `protobuf:"bytes,2,opt,name=msg" json:"msg,omitempty"`
}
func (*Pong) Descriptor ¶
func (*Pong) ProtoMessage ¶
func (*Pong) ProtoMessage()
type ServerPayload ¶
type ServerPayload struct {
// 唯一标识,由loop端内部生成,一般仅留作ack或者resp使用
Seq string `protobuf:"bytes,1,opt,name=seq" json:"seq,omitempty"`
// 是否需要ack
NeedAck bool `protobuf:"varint,2,opt,name=need_ack,json=needAck" json:"need_ack,omitempty"`
// Types that are valid to be assigned to Body:
// *ServerPayload_Pong
// *ServerPayload_MsgsWrapper
// *ServerPayload_SubResp
Body isServerPayload_Body `protobuf_oneof:"Body"`
}
loop端发送给客户端(实为N个业务消息组成)
func (*ServerPayload) Descriptor ¶
func (*ServerPayload) Descriptor() ([]byte, []int)
func (*ServerPayload) GetBody ¶
func (m *ServerPayload) GetBody() isServerPayload_Body
func (*ServerPayload) GetMsgsWrapper ¶
func (m *ServerPayload) GetMsgsWrapper() *MessagesWrapper
func (*ServerPayload) GetNeedAck ¶
func (m *ServerPayload) GetNeedAck() bool
func (*ServerPayload) GetPong ¶
func (m *ServerPayload) GetPong() *Pong
func (*ServerPayload) GetSeq ¶
func (m *ServerPayload) GetSeq() string
func (*ServerPayload) GetSubResp ¶
func (m *ServerPayload) GetSubResp() *CommonResponse
func (*ServerPayload) ProtoMessage ¶
func (*ServerPayload) ProtoMessage()
func (*ServerPayload) Reset ¶
func (m *ServerPayload) Reset()
func (*ServerPayload) String ¶
func (m *ServerPayload) String() string
func (*ServerPayload) XXX_OneofFuncs ¶
func (*ServerPayload) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type ServerPayload_MsgsWrapper ¶
type ServerPayload_MsgsWrapper struct {
MsgsWrapper *MessagesWrapper `protobuf:"bytes,12,opt,name=msgs_wrapper,json=msgsWrapper,oneof"`
}
type ServerPayload_Pong ¶
type ServerPayload_Pong struct {
Pong *Pong `protobuf:"bytes,11,opt,name=pong,oneof"`
}
type ServerPayload_SubResp ¶
type ServerPayload_SubResp struct {
SubResp *CommonResponse `protobuf:"bytes,13,opt,name=sub_resp,json=subResp,oneof"`
}
type SubRoomRequest ¶
type SubRoomRequest struct {
Room string `protobuf:"bytes,1,opt,name=room" json:"room,omitempty"`
Params *google_protobuf.Any `protobuf:"bytes,2,opt,name=params" json:"params,omitempty"`
}
会话需要订阅某房间的业务逻辑时需要发送此消息
func (*SubRoomRequest) Descriptor ¶
func (*SubRoomRequest) Descriptor() ([]byte, []int)
func (*SubRoomRequest) GetParams ¶
func (m *SubRoomRequest) GetParams() *google_protobuf.Any
func (*SubRoomRequest) GetRoom ¶
func (m *SubRoomRequest) GetRoom() string
func (*SubRoomRequest) ProtoMessage ¶
func (*SubRoomRequest) ProtoMessage()
func (*SubRoomRequest) Reset ¶
func (m *SubRoomRequest) Reset()
func (*SubRoomRequest) String ¶
func (m *SubRoomRequest) String() string
Click to show internal directories.
Click to hide internal directories.