Documentation
¶
Index ¶
- Constants
- Variables
- func NewDemoEndpoints() []*api.Endpoint
- func NewRoomEndpoints() []*api.Endpoint
- func RegisterDemoHandler(s server.Server, hdlr DemoHandler, opts ...server.HandlerOption) error
- func RegisterRoomHandler(s server.Server, hdlr RoomHandler, opts ...server.HandlerOption) error
- type Demo
- type DemoHandler
- type DemoService
- type EnterReq
- func (*EnterReq) Descriptor() ([]byte, []int)
- func (m *EnterReq) GetInfo() *MsgEnterRoom
- func (m *EnterReq) GetRoom() string
- func (*EnterReq) ProtoMessage()
- func (m *EnterReq) Reset()
- func (m *EnterReq) String() string
- func (m *EnterReq) XXX_DiscardUnknown()
- func (m *EnterReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *EnterReq) XXX_Merge(src proto.Message)
- func (m *EnterReq) XXX_Size() int
- func (m *EnterReq) XXX_Unmarshal(b []byte) error
- type EnterRes
- func (*EnterRes) Descriptor() ([]byte, []int)
- func (m *EnterRes) GetUids() []string
- func (*EnterRes) ProtoMessage()
- func (m *EnterRes) Reset()
- func (m *EnterRes) String() string
- func (m *EnterRes) XXX_DiscardUnknown()
- func (m *EnterRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *EnterRes) XXX_Merge(src proto.Message)
- func (m *EnterRes) XXX_Size() int
- func (m *EnterRes) XXX_Unmarshal(b []byte) error
- type HelloReq
- func (*HelloReq) Descriptor() ([]byte, []int)
- func (m *HelloReq) GetSay() string
- func (m *HelloReq) GetSleep() int32
- func (*HelloReq) ProtoMessage()
- func (m *HelloReq) Reset()
- func (m *HelloReq) String() string
- func (m *HelloReq) XXX_DiscardUnknown()
- func (m *HelloReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *HelloReq) XXX_Merge(src proto.Message)
- func (m *HelloReq) XXX_Size() int
- func (m *HelloReq) XXX_Unmarshal(b []byte) error
- type HelloRes
- func (*HelloRes) Descriptor() ([]byte, []int)
- func (m *HelloRes) GetAccount() []*KV
- func (m *HelloRes) GetAck() string
- func (m *HelloRes) GetTime() float32
- func (*HelloRes) ProtoMessage()
- func (m *HelloRes) Reset()
- func (m *HelloRes) String() string
- func (m *HelloRes) XXX_DiscardUnknown()
- func (m *HelloRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *HelloRes) XXX_Merge(src proto.Message)
- func (m *HelloRes) XXX_Size() int
- func (m *HelloRes) XXX_Unmarshal(b []byte) error
- type KV
- func (*KV) Descriptor() ([]byte, []int)
- func (m *KV) GetKey() string
- func (m *KV) GetValue() string
- func (*KV) ProtoMessage()
- func (m *KV) Reset()
- func (m *KV) String() string
- func (m *KV) XXX_DiscardUnknown()
- func (m *KV) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *KV) XXX_Merge(src proto.Message)
- func (m *KV) XXX_Size() int
- func (m *KV) XXX_Unmarshal(b []byte) error
- type LeaveReq
- func (*LeaveReq) Descriptor() ([]byte, []int)
- func (m *LeaveReq) GetRoom() string
- func (*LeaveReq) ProtoMessage()
- func (m *LeaveReq) Reset()
- func (m *LeaveReq) String() string
- func (m *LeaveReq) XXX_DiscardUnknown()
- func (m *LeaveReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LeaveReq) XXX_Merge(src proto.Message)
- func (m *LeaveReq) XXX_Size() int
- func (m *LeaveReq) XXX_Unmarshal(b []byte) error
- type LeaveRes
- func (*LeaveRes) Descriptor() ([]byte, []int)
- func (*LeaveRes) ProtoMessage()
- func (m *LeaveRes) Reset()
- func (m *LeaveRes) String() string
- func (m *LeaveRes) XXX_DiscardUnknown()
- func (m *LeaveRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LeaveRes) XXX_Merge(src proto.Message)
- func (m *LeaveRes) XXX_Size() int
- func (m *LeaveRes) XXX_Unmarshal(b []byte) error
- type MsgEnterRoom
- func (*MsgEnterRoom) Descriptor() ([]byte, []int)
- func (m *MsgEnterRoom) GetAgent() string
- func (m *MsgEnterRoom) GetAvatar() string
- func (m *MsgEnterRoom) GetIpaddr() string
- func (m *MsgEnterRoom) GetLocation() string
- func (m *MsgEnterRoom) GetName() string
- func (*MsgEnterRoom) ProtoMessage()
- func (m *MsgEnterRoom) Reset()
- func (m *MsgEnterRoom) String() string
- func (m *MsgEnterRoom) XXX_DiscardUnknown()
- func (m *MsgEnterRoom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgEnterRoom) XXX_Merge(src proto.Message)
- func (m *MsgEnterRoom) XXX_Size() int
- func (m *MsgEnterRoom) XXX_Unmarshal(b []byte) error
- type MsgLeaveRoom
- func (*MsgLeaveRoom) Descriptor() ([]byte, []int)
- func (*MsgLeaveRoom) ProtoMessage()
- func (m *MsgLeaveRoom) Reset()
- func (m *MsgLeaveRoom) String() string
- func (m *MsgLeaveRoom) XXX_DiscardUnknown()
- func (m *MsgLeaveRoom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgLeaveRoom) XXX_Merge(src proto.Message)
- func (m *MsgLeaveRoom) XXX_Size() int
- func (m *MsgLeaveRoom) XXX_Unmarshal(b []byte) error
- type MsgPlainText
- func (*MsgPlainText) Descriptor() ([]byte, []int)
- func (m *MsgPlainText) GetText() string
- func (*MsgPlainText) ProtoMessage()
- func (m *MsgPlainText) Reset()
- func (m *MsgPlainText) String() string
- func (m *MsgPlainText) XXX_DiscardUnknown()
- func (m *MsgPlainText) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgPlainText) XXX_Merge(src proto.Message)
- func (m *MsgPlainText) XXX_Size() int
- func (m *MsgPlainText) XXX_Unmarshal(b []byte) error
- type RecvReq
- func (*RecvReq) Descriptor() ([]byte, []int)
- func (m *RecvReq) GetLastSeq() uint64
- func (m *RecvReq) GetOffsetNewest() bool
- func (m *RecvReq) GetRoom() string
- func (*RecvReq) ProtoMessage()
- func (m *RecvReq) Reset()
- func (m *RecvReq) String() string
- func (m *RecvReq) XXX_DiscardUnknown()
- func (m *RecvReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RecvReq) XXX_Merge(src proto.Message)
- func (m *RecvReq) XXX_Size() int
- func (m *RecvReq) XXX_Unmarshal(b []byte) error
- type RecvRes
- func (*RecvRes) Descriptor() ([]byte, []int)
- func (m *RecvRes) GetMsgs() []*RoomMessage
- func (*RecvRes) ProtoMessage()
- func (m *RecvRes) Reset()
- func (m *RecvRes) String() string
- func (m *RecvRes) XXX_DiscardUnknown()
- func (m *RecvRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RecvRes) XXX_Merge(src proto.Message)
- func (m *RecvRes) XXX_Size() int
- func (m *RecvRes) XXX_Unmarshal(b []byte) error
- type Room
- func (r *Room) Enter(ctx context.Context, req *EnterReq, res *EnterRes) error
- func (r *Room) Init()
- func (r *Room) Leave(ctx context.Context, req *LeaveReq, res *LeaveRes) error
- func (r *Room) Recv(ctx context.Context, req *RecvReq, res *RecvRes) error
- func (r *Room) Send(ctx context.Context, req *SendReq, res *SendRes) error
- type RoomHandler
- type RoomMessage
- func (*RoomMessage) Descriptor() ([]byte, []int)
- func (m *RoomMessage) GetEnterRoom() *MsgEnterRoom
- func (m *RoomMessage) GetLeaveRoom() *MsgLeaveRoom
- func (m *RoomMessage) GetPlainText() *MsgPlainText
- func (m *RoomMessage) GetRoom() string
- func (m *RoomMessage) GetSendAt() int64
- func (m *RoomMessage) GetSeq() uint64
- func (m *RoomMessage) GetType() RoomMessage_Type
- func (m *RoomMessage) GetUid() string
- func (*RoomMessage) ProtoMessage()
- func (m *RoomMessage) Reset()
- func (m *RoomMessage) String() string
- func (m *RoomMessage) XXX_DiscardUnknown()
- func (m *RoomMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RoomMessage) XXX_Merge(src proto.Message)
- func (m *RoomMessage) XXX_Size() int
- func (m *RoomMessage) XXX_Unmarshal(b []byte) error
- type RoomMessage_Type
- type RoomService
- type SendReq
- func (*SendReq) Descriptor() ([]byte, []int)
- func (m *SendReq) GetRoom() string
- func (m *SendReq) GetText() string
- func (*SendReq) ProtoMessage()
- func (m *SendReq) Reset()
- func (m *SendReq) String() string
- func (m *SendReq) XXX_DiscardUnknown()
- func (m *SendReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SendReq) XXX_Merge(src proto.Message)
- func (m *SendReq) XXX_Size() int
- func (m *SendReq) XXX_Unmarshal(b []byte) error
- type SendRes
- func (*SendRes) Descriptor() ([]byte, []int)
- func (*SendRes) ProtoMessage()
- func (m *SendRes) Reset()
- func (m *SendRes) String() string
- func (m *SendRes) XXX_DiscardUnknown()
- func (m *SendRes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SendRes) XXX_Merge(src proto.Message)
- func (m *SendRes) XXX_Size() int
- func (m *SendRes) XXX_Unmarshal(b []byte) error
- type Server
Constants ¶
View Source
const (
ServiceName = "liveroom"
)
Variables ¶
View Source
var RoomMessage_Type_name = map[int32]string{
0: "UNSPECIFIED",
1: "ENTER_ROOM",
2: "LEAVE_ROOM",
3: "PLAIN_TEXT",
}
View Source
var RoomMessage_Type_value = map[string]int32{
"UNSPECIFIED": 0,
"ENTER_ROOM": 1,
"LEAVE_ROOM": 2,
"PLAIN_TEXT": 3,
}
Functions ¶
func NewDemoEndpoints ¶
func NewRoomEndpoints ¶
func RegisterDemoHandler ¶
func RegisterDemoHandler(s server.Server, hdlr DemoHandler, opts ...server.HandlerOption) error
func RegisterRoomHandler ¶
func RegisterRoomHandler(s server.Server, hdlr RoomHandler, opts ...server.HandlerOption) error
Types ¶
type DemoHandler ¶
type DemoService ¶
type DemoService interface {
Hello(ctx context.Context, in *HelloReq, opts ...client.CallOption) (*HelloRes, error)
}
func NewDemoService ¶
func NewDemoService(name string, c client.Client) DemoService
type EnterReq ¶
type EnterReq struct { Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` Info *MsgEnterRoom `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*EnterReq) Descriptor ¶
func (*EnterReq) GetInfo ¶
func (m *EnterReq) GetInfo() *MsgEnterRoom
func (*EnterReq) ProtoMessage ¶
func (*EnterReq) ProtoMessage()
func (*EnterReq) XXX_DiscardUnknown ¶
func (m *EnterReq) XXX_DiscardUnknown()
func (*EnterReq) XXX_Marshal ¶
func (*EnterReq) XXX_Unmarshal ¶
type EnterRes ¶
type EnterRes struct { Uids []string `protobuf:"bytes,1,rep,name=uids,proto3" json:"uids,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*EnterRes) Descriptor ¶
func (*EnterRes) ProtoMessage ¶
func (*EnterRes) ProtoMessage()
func (*EnterRes) XXX_DiscardUnknown ¶
func (m *EnterRes) XXX_DiscardUnknown()
func (*EnterRes) XXX_Marshal ¶
func (*EnterRes) XXX_Unmarshal ¶
type HelloReq ¶
type HelloReq struct { Say string `protobuf:"bytes,1,opt,name=say,proto3" json:"say,omitempty"` Sleep int32 `protobuf:"varint,2,opt,name=sleep,proto3" json:"sleep,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*HelloReq) Descriptor ¶
func (*HelloReq) ProtoMessage ¶
func (*HelloReq) ProtoMessage()
func (*HelloReq) XXX_DiscardUnknown ¶
func (m *HelloReq) XXX_DiscardUnknown()
func (*HelloReq) XXX_Marshal ¶
func (*HelloReq) XXX_Unmarshal ¶
type HelloRes ¶
type HelloRes struct { Ack string `protobuf:"bytes,1,opt,name=ack,proto3" json:"ack,omitempty"` Account []*KV `protobuf:"bytes,2,rep,name=account,proto3" json:"account,omitempty"` Time float32 `protobuf:"fixed32,3,opt,name=time,proto3" json:"time,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*HelloRes) Descriptor ¶
func (*HelloRes) GetAccount ¶
func (*HelloRes) ProtoMessage ¶
func (*HelloRes) ProtoMessage()
func (*HelloRes) XXX_DiscardUnknown ¶
func (m *HelloRes) XXX_DiscardUnknown()
func (*HelloRes) XXX_Marshal ¶
func (*HelloRes) XXX_Unmarshal ¶
type KV ¶
type KV struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*KV) Descriptor ¶
func (*KV) ProtoMessage ¶
func (*KV) ProtoMessage()
func (*KV) XXX_DiscardUnknown ¶
func (m *KV) XXX_DiscardUnknown()
func (*KV) XXX_Unmarshal ¶
type LeaveReq ¶
type LeaveReq struct { Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LeaveReq) Descriptor ¶
func (*LeaveReq) ProtoMessage ¶
func (*LeaveReq) ProtoMessage()
func (*LeaveReq) XXX_DiscardUnknown ¶
func (m *LeaveReq) XXX_DiscardUnknown()
func (*LeaveReq) XXX_Marshal ¶
func (*LeaveReq) XXX_Unmarshal ¶
type LeaveRes ¶
type LeaveRes struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*LeaveRes) Descriptor ¶
func (*LeaveRes) ProtoMessage ¶
func (*LeaveRes) ProtoMessage()
func (*LeaveRes) XXX_DiscardUnknown ¶
func (m *LeaveRes) XXX_DiscardUnknown()
func (*LeaveRes) XXX_Marshal ¶
func (*LeaveRes) XXX_Unmarshal ¶
type MsgEnterRoom ¶
type MsgEnterRoom struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Agent string `protobuf:"bytes,2,opt,name=agent,proto3" json:"agent,omitempty"` Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"` Ipaddr string `protobuf:"bytes,4,opt,name=ipaddr,proto3" json:"ipaddr,omitempty"` Location string `protobuf:"bytes,5,opt,name=location,proto3" json:"location,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
进入聊天室
func (*MsgEnterRoom) Descriptor ¶
func (*MsgEnterRoom) Descriptor() ([]byte, []int)
func (*MsgEnterRoom) GetAgent ¶
func (m *MsgEnterRoom) GetAgent() string
func (*MsgEnterRoom) GetAvatar ¶
func (m *MsgEnterRoom) GetAvatar() string
func (*MsgEnterRoom) GetIpaddr ¶
func (m *MsgEnterRoom) GetIpaddr() string
func (*MsgEnterRoom) GetLocation ¶
func (m *MsgEnterRoom) GetLocation() string
func (*MsgEnterRoom) GetName ¶
func (m *MsgEnterRoom) GetName() string
func (*MsgEnterRoom) ProtoMessage ¶
func (*MsgEnterRoom) ProtoMessage()
func (*MsgEnterRoom) Reset ¶
func (m *MsgEnterRoom) Reset()
func (*MsgEnterRoom) String ¶
func (m *MsgEnterRoom) String() string
func (*MsgEnterRoom) XXX_DiscardUnknown ¶
func (m *MsgEnterRoom) XXX_DiscardUnknown()
func (*MsgEnterRoom) XXX_Marshal ¶
func (m *MsgEnterRoom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgEnterRoom) XXX_Merge ¶
func (m *MsgEnterRoom) XXX_Merge(src proto.Message)
func (*MsgEnterRoom) XXX_Size ¶
func (m *MsgEnterRoom) XXX_Size() int
func (*MsgEnterRoom) XXX_Unmarshal ¶
func (m *MsgEnterRoom) XXX_Unmarshal(b []byte) error
type MsgLeaveRoom ¶
type MsgLeaveRoom struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
退出聊天室
func (*MsgLeaveRoom) Descriptor ¶
func (*MsgLeaveRoom) Descriptor() ([]byte, []int)
func (*MsgLeaveRoom) ProtoMessage ¶
func (*MsgLeaveRoom) ProtoMessage()
func (*MsgLeaveRoom) Reset ¶
func (m *MsgLeaveRoom) Reset()
func (*MsgLeaveRoom) String ¶
func (m *MsgLeaveRoom) String() string
func (*MsgLeaveRoom) XXX_DiscardUnknown ¶
func (m *MsgLeaveRoom) XXX_DiscardUnknown()
func (*MsgLeaveRoom) XXX_Marshal ¶
func (m *MsgLeaveRoom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgLeaveRoom) XXX_Merge ¶
func (m *MsgLeaveRoom) XXX_Merge(src proto.Message)
func (*MsgLeaveRoom) XXX_Size ¶
func (m *MsgLeaveRoom) XXX_Size() int
func (*MsgLeaveRoom) XXX_Unmarshal ¶
func (m *MsgLeaveRoom) XXX_Unmarshal(b []byte) error
type MsgPlainText ¶
type MsgPlainText struct { Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
聊天室文本消息
func (*MsgPlainText) Descriptor ¶
func (*MsgPlainText) Descriptor() ([]byte, []int)
func (*MsgPlainText) GetText ¶
func (m *MsgPlainText) GetText() string
func (*MsgPlainText) ProtoMessage ¶
func (*MsgPlainText) ProtoMessage()
func (*MsgPlainText) Reset ¶
func (m *MsgPlainText) Reset()
func (*MsgPlainText) String ¶
func (m *MsgPlainText) String() string
func (*MsgPlainText) XXX_DiscardUnknown ¶
func (m *MsgPlainText) XXX_DiscardUnknown()
func (*MsgPlainText) XXX_Marshal ¶
func (m *MsgPlainText) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgPlainText) XXX_Merge ¶
func (m *MsgPlainText) XXX_Merge(src proto.Message)
func (*MsgPlainText) XXX_Size ¶
func (m *MsgPlainText) XXX_Size() int
func (*MsgPlainText) XXX_Unmarshal ¶
func (m *MsgPlainText) XXX_Unmarshal(b []byte) error
type RecvReq ¶
type RecvReq struct { // 聊天室ID Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` // 客户端记住的已经收取到的最后一条消息的序列号 LastSeq uint64 `protobuf:"varint,2,opt,name=last_seq,json=lastSeq,proto3" json:"last_seq,omitempty"` // 是否从最新的消息开始接收。这个选项只在客户端首次收取消息,也就是last_seq=0时,有效。 // 为了防止漏掉消息,客户端下次收取必须从前一次收取到的消息的last_seq开始。 OffsetNewest bool `protobuf:"varint,3,opt,name=offset_newest,json=offsetNewest,proto3" json:"offset_newest,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RecvReq) Descriptor ¶
func (*RecvReq) GetLastSeq ¶
func (*RecvReq) GetOffsetNewest ¶
func (*RecvReq) ProtoMessage ¶
func (*RecvReq) ProtoMessage()
func (*RecvReq) XXX_DiscardUnknown ¶
func (m *RecvReq) XXX_DiscardUnknown()
func (*RecvReq) XXX_Marshal ¶
func (*RecvReq) XXX_Unmarshal ¶
type RecvRes ¶
type RecvRes struct { // 本次收取的所有未读消息,按seq排序,最小的seq必须比last_seq大 Msgs []*RoomMessage `protobuf:"bytes,1,rep,name=msgs,proto3" json:"msgs,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*RecvRes) Descriptor ¶
func (*RecvRes) GetMsgs ¶
func (m *RecvRes) GetMsgs() []*RoomMessage
func (*RecvRes) ProtoMessage ¶
func (*RecvRes) ProtoMessage()
func (*RecvRes) XXX_DiscardUnknown ¶
func (m *RecvRes) XXX_DiscardUnknown()
func (*RecvRes) XXX_Marshal ¶
func (*RecvRes) XXX_Unmarshal ¶
type RoomHandler ¶
type RoomHandler interface { // 进入聊天室 Enter(context.Context, *EnterReq, *EnterRes) error // 在聊天室里,发送消息 Send(context.Context, *SendReq, *SendRes) error // 收取聊天室里的未读消息。 // 这是一个 long-polling 机制的方法,需要指定 `Request-Timeout` 头, // 表示当聊天室里没有未读消息时,轮询多少秒。当聊天室里有未读消息时,立刻返回。 Recv(context.Context, *RecvReq, *RecvRes) error // 退出聊天室 Leave(context.Context, *LeaveReq, *LeaveRes) error }
type RoomMessage ¶
type RoomMessage struct { // // 聊天室ID Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` // 聊天室里的每条消息都有唯一的seq,新消息的seq总是更大 Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` // 消息类型 Type RoomMessage_Type `protobuf:"varint,3,opt,name=type,proto3,enum=liveroom.RoomMessage_Type" json:"type,omitempty"` // 谁发出的消息 Uid string `protobuf:"bytes,4,opt,name=uid,proto3" json:"uid,omitempty"` // 何时发出的消息(毫秒时间戳) SendAt int64 `protobuf:"varint,5,opt,name=send_at,json=sendAt,proto3" json:"send_at,omitempty"` // 具体消息对象,与消息类型对应 EnterRoom *MsgEnterRoom `protobuf:"bytes,6,opt,name=enter_room,json=enterRoom,proto3" json:"enter_room,omitempty"` LeaveRoom *MsgLeaveRoom `protobuf:"bytes,7,opt,name=leave_room,json=leaveRoom,proto3" json:"leave_room,omitempty"` PlainText *MsgPlainText `protobuf:"bytes,8,opt,name=plain_text,json=plainText,proto3" json:"plain_text,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
聊天室消息
func (*RoomMessage) Descriptor ¶
func (*RoomMessage) Descriptor() ([]byte, []int)
func (*RoomMessage) GetEnterRoom ¶
func (m *RoomMessage) GetEnterRoom() *MsgEnterRoom
func (*RoomMessage) GetLeaveRoom ¶
func (m *RoomMessage) GetLeaveRoom() *MsgLeaveRoom
func (*RoomMessage) GetPlainText ¶
func (m *RoomMessage) GetPlainText() *MsgPlainText
func (*RoomMessage) GetRoom ¶
func (m *RoomMessage) GetRoom() string
func (*RoomMessage) GetSendAt ¶
func (m *RoomMessage) GetSendAt() int64
func (*RoomMessage) GetSeq ¶
func (m *RoomMessage) GetSeq() uint64
func (*RoomMessage) GetType ¶
func (m *RoomMessage) GetType() RoomMessage_Type
func (*RoomMessage) GetUid ¶
func (m *RoomMessage) GetUid() string
func (*RoomMessage) ProtoMessage ¶
func (*RoomMessage) ProtoMessage()
func (*RoomMessage) Reset ¶
func (m *RoomMessage) Reset()
func (*RoomMessage) String ¶
func (m *RoomMessage) String() string
func (*RoomMessage) XXX_DiscardUnknown ¶
func (m *RoomMessage) XXX_DiscardUnknown()
func (*RoomMessage) XXX_Marshal ¶
func (m *RoomMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RoomMessage) XXX_Merge ¶
func (m *RoomMessage) XXX_Merge(src proto.Message)
func (*RoomMessage) XXX_Size ¶
func (m *RoomMessage) XXX_Size() int
func (*RoomMessage) XXX_Unmarshal ¶
func (m *RoomMessage) XXX_Unmarshal(b []byte) error
type RoomMessage_Type ¶
type RoomMessage_Type int32
消息类型
const ( RoomMessage_UNSPECIFIED RoomMessage_Type = 0 RoomMessage_ENTER_ROOM RoomMessage_Type = 1 RoomMessage_LEAVE_ROOM RoomMessage_Type = 2 RoomMessage_PLAIN_TEXT RoomMessage_Type = 3 )
func (RoomMessage_Type) EnumDescriptor ¶
func (RoomMessage_Type) EnumDescriptor() ([]byte, []int)
func (RoomMessage_Type) String ¶
func (x RoomMessage_Type) String() string
type RoomService ¶
type RoomService interface { // 进入聊天室 Enter(ctx context.Context, in *EnterReq, opts ...client.CallOption) (*EnterRes, error) // 在聊天室里,发送消息 Send(ctx context.Context, in *SendReq, opts ...client.CallOption) (*SendRes, error) // 收取聊天室里的未读消息。 // 这是一个 long-polling 机制的方法,需要指定 `Request-Timeout` 头, // 表示当聊天室里没有未读消息时,轮询多少秒。当聊天室里有未读消息时,立刻返回。 Recv(ctx context.Context, in *RecvReq, opts ...client.CallOption) (*RecvRes, error) // 退出聊天室 Leave(ctx context.Context, in *LeaveReq, opts ...client.CallOption) (*LeaveRes, error) }
func NewRoomService ¶
func NewRoomService(name string, c client.Client) RoomService
type SendReq ¶
type SendReq struct { Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SendReq) Descriptor ¶
func (*SendReq) ProtoMessage ¶
func (*SendReq) ProtoMessage()
func (*SendReq) XXX_DiscardUnknown ¶
func (m *SendReq) XXX_DiscardUnknown()
func (*SendReq) XXX_Marshal ¶
func (*SendReq) XXX_Unmarshal ¶
type SendRes ¶
type SendRes struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SendRes) Descriptor ¶
func (*SendRes) ProtoMessage ¶
func (*SendRes) ProtoMessage()
func (*SendRes) XXX_DiscardUnknown ¶
func (m *SendRes) XXX_DiscardUnknown()
func (*SendRes) XXX_Marshal ¶
func (*SendRes) XXX_Unmarshal ¶
type Server ¶
type Server struct { Namespace string `json:"namespace"` Production bool `json:"production"` LogOutputPaths []string `json:"logging_output_paths"` RedisServerAddress string `json:"redis_server_address"` NatsServerAddress string `json:"nats_server_address"` // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.