ws add logout remove push token

pull/351/head
Gordon 3 years ago
parent 59b625b7c0
commit eba25f1bb8

@ -8,6 +8,7 @@ import (
promePkg "Open_IM/pkg/common/prometheus" promePkg "Open_IM/pkg/common/prometheus"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbChat "Open_IM/pkg/proto/msg" pbChat "Open_IM/pkg/proto/msg"
push "Open_IM/pkg/proto/push"
pbRtc "Open_IM/pkg/proto/rtc" pbRtc "Open_IM/pkg/proto/rtc"
sdk_ws "Open_IM/pkg/proto/sdk_ws" sdk_ws "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
@ -58,7 +59,7 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
promePkg.PromeInc(promePkg.PullMsgBySeqListTotalCounter) promePkg.PromeInc(promePkg.PullMsgBySeqListTotalCounter)
case constant.WsLogoutMsg: case constant.WsLogoutMsg:
log.NewInfo(m.OperationID, "conn.Close()", m.SendID, m.MsgIncr, m.ReqIdentifier) log.NewInfo(m.OperationID, "conn.Close()", m.SendID, m.MsgIncr, m.ReqIdentifier)
// conn.Close() ws.userLogoutReq(conn, &m)
default: default:
log.Error(m.OperationID, "ReqIdentifier failed ", m.SendID, m.MsgIncr, m.ReqIdentifier) log.Error(m.OperationID, "ReqIdentifier failed ", m.SendID, m.MsgIncr, m.ReqIdentifier)
} }
@ -157,7 +158,6 @@ func (ws *WServer) pullMsgBySeqListReq(conn *UserConn, m *Req) {
ws.pullMsgBySeqListResp(conn, m, nReply) ws.pullMsgBySeqListResp(conn, m, nReply)
} }
} }
func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullMessageBySeqListResp) { func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullMessageBySeqListResp) {
log.NewInfo(m.OperationID, "pullMsgBySeqListResp come here ", pb.String()) log.NewInfo(m.OperationID, "pullMsgBySeqListResp come here ", pb.String())
c, _ := proto.Marshal(pb) c, _ := proto.Marshal(pb)
@ -173,7 +173,40 @@ func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullM
len(mReply.Data)) len(mReply.Data))
ws.sendMsg(conn, mReply) ws.sendMsg(conn, mReply)
} }
func (ws *WServer) userLogoutReq(conn *UserConn, m *Req) {
log.NewInfo(m.OperationID, "Ws call success to userLogoutReq start", m.SendID, m.ReqIdentifier, m.MsgIncr, string(m.Data))
rpcReq := push.DelUserPushTokenReq{}
rpcReq.UserID = m.SendID
rpcReq.OperationID = m.OperationID
grpcConn := getcdv3.GetDefaultConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImPushName, m.OperationID)
if grpcConn == nil {
errMsg := rpcReq.OperationID + "getcdv3.GetDefaultConn == nil"
log.NewError(rpcReq.OperationID, errMsg)
ws.userLogoutResp(conn, m)
return
}
msgClient := push.NewPushMsgServiceClient(grpcConn)
reply, err := msgClient.DelUserPushToken(context.Background(), &rpcReq)
if err != nil {
log.NewError(rpcReq.OperationID, "DelUserPushToken err", err.Error())
ws.userLogoutResp(conn, m)
} else {
log.NewInfo(rpcReq.OperationID, "rpc call success to DelUserPushToken", reply.String())
ws.userLogoutResp(conn, m)
}
ws.userLogoutResp(conn, m)
}
func (ws *WServer) userLogoutResp(conn *UserConn, m *Req) {
mReply := Resp{
ReqIdentifier: m.ReqIdentifier,
MsgIncr: m.MsgIncr,
OperationID: m.OperationID,
}
ws.sendMsg(conn, mReply)
_ = conn.Close()
}
func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) { func (ws *WServer) sendMsgReq(conn *UserConn, m *Req) {
sendMsgAllCountLock.Lock() sendMsgAllCountLock.Lock()
sendMsgAllCount++ sendMsgAllCount++
@ -233,6 +266,7 @@ func (ws *WServer) sendMsgResp(conn *UserConn, m *Req, pb *pbChat.SendMsgResp) {
Data: b, Data: b,
} }
ws.sendMsg(conn, mReply) ws.sendMsg(conn, mReply)
} }
func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) { func (ws *WServer) sendSignalMsgReq(conn *UserConn, m *Req) {

@ -29,6 +29,7 @@ import (
type UserConn struct { type UserConn struct {
*websocket.Conn *websocket.Conn
w *sync.Mutex w *sync.Mutex
platformID int32
PushedMaxSeq uint32 PushedMaxSeq uint32
} }
type WServer struct { type WServer struct {
@ -74,7 +75,7 @@ func (ws *WServer) wsHandler(w http.ResponseWriter, r *http.Request) {
log.Error(operationID, "upgrade http conn err", err.Error(), query) log.Error(operationID, "upgrade http conn err", err.Error(), query)
return return
} else { } else {
newConn := &UserConn{conn, new(sync.Mutex), 0} newConn := &UserConn{conn, new(sync.Mutex), utils.StringToInt32(query["platformID"][0]), 0}
userCount++ userCount++
ws.addUserConn(query["sendID"][0], utils.StringToInt(query["platformID"][0]), newConn, query["token"][0], operationID) ws.addUserConn(query["sendID"][0], utils.StringToInt(query["platformID"][0]), newConn, query["token"][0], operationID)
go ws.readMsg(newConn) go ws.readMsg(newConn)

@ -3,6 +3,7 @@ package logic
import ( import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
promePkg "Open_IM/pkg/common/prometheus" promePkg "Open_IM/pkg/common/prometheus"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
@ -10,7 +11,6 @@ import (
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"net" "net"
"strconv" "strconv"
"strings" "strings"
@ -91,3 +91,15 @@ func (r *RPCServer) PushMsg(_ context.Context, pbData *pbPush.PushMsgReq) (*pbPu
}, nil }, nil
} }
func (r *RPCServer) DelUserPushToken(c context.Context, req *pbPush.DelUserPushTokenReq) (*pbPush.DelUserPushTokenResp, error) {
var resp pbPush.DelUserPushTokenResp
err := db.DB.DelFcmToken(req.UserID, int(req.PlatformID))
if err != nil {
errMsg := req.OperationID + " " + "SetFcmToken failed " + err.Error()
log.NewError(req.OperationID, errMsg)
resp.ErrCode = 500
resp.ErrMsg = errMsg
}
return &resp, nil
}

@ -410,15 +410,19 @@ func (d *DataBases) GetSendMsgStatus(operationID string) (int, error) {
return status, err return status, err
} }
func (d *DataBases) SetFcmToken(account string, platformid int, fcmToken string, expireTime int64) (err error) { func (d *DataBases) SetFcmToken(account string, platformID int, fcmToken string, expireTime int64) (err error) {
key := FcmToken + account + ":" + strconv.Itoa(platformid) key := FcmToken + account + ":" + strconv.Itoa(platformID)
return d.RDB.Set(context.Background(), key, fcmToken, time.Duration(expireTime)*time.Second).Err() return d.RDB.Set(context.Background(), key, fcmToken, time.Duration(expireTime)*time.Second).Err()
} }
func (d *DataBases) GetFcmToken(account string, platformid int) (string, error) { func (d *DataBases) GetFcmToken(account string, platformID int) (string, error) {
key := FcmToken + account + ":" + strconv.Itoa(platformid) key := FcmToken + account + ":" + strconv.Itoa(platformID)
return d.RDB.Get(context.Background(), key).Result() return d.RDB.Get(context.Background(), key).Result()
} }
func (d *DataBases) DelFcmToken(account string, platformID int) error {
key := FcmToken + account + ":" + strconv.Itoa(platformID)
return d.RDB.Del(context.Background(), key).Err()
}
func (d *DataBases) IncrUserBadgeUnreadCountSum(uid string) (int, error) { func (d *DataBases) IncrUserBadgeUnreadCountSum(uid string) (int, error) {
key := userBadgeUnreadCountSum + uid key := userBadgeUnreadCountSum + uid
seq, err := d.RDB.Incr(context.Background(), key).Result() seq, err := d.RDB.Incr(context.Background(), key).Result()

@ -125,23 +125,6 @@ func init() {
fmt.Println("createMongoIndex success") fmt.Println("createMongoIndex success")
DB.mongoClient = mongoClient DB.mongoClient = mongoClient
// redis pool init
//DB.redisPool = &redis.Pool{
// MaxIdle: config.Config.Redis.DBMaxIdle,
// MaxActive: config.Config.Redis.DBMaxActive,
// IdleTimeout: time.Duration(config.Config.Redis.DBIdleTimeout) * time.Second,
// Dial: func() (redis.Conn, error) {
// return redis.Dial(
// "tcp",
// config.Config.Redis.DBAddress,
// redis.DialReadTimeout(time.Duration(1000)*time.Millisecond),
// redis.DialWriteTimeout(time.Duration(1000)*time.Millisecond),
// redis.DialConnectTimeout(time.Duration(1000)*time.Millisecond),
// redis.DialDatabase(0),
// redis.DialPassword(config.Config.Redis.DBPassWord),
// )
// },
//}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel() defer cancel()
if config.Config.Redis.EnableCluster { if config.Config.Redis.EnableCluster {

@ -1,291 +1,274 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.15.5
// source: push/push.proto // source: push/push.proto
package pbPush package pbPush // import "Open_IM/pkg/proto/push"
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import sdk_ws "Open_IM/pkg/proto/sdk_ws"
import ( import (
sdk_ws "Open_IM/pkg/proto/sdk_ws" context "golang.org/x/net/context"
context "context"
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
) )
const ( // Reference imports to suppress errors if they are not otherwise used.
// Verify that this generated code is sufficiently up-to-date. var _ = proto.Marshal
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) var _ = fmt.Errorf
// Verify that runtime/protoimpl is sufficiently up-to-date. var _ = math.Inf
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type PushMsgReq struct { // This is a compile-time assertion to ensure that this generated file
state protoimpl.MessageState // is compatible with the proto package it is being compiled against.
sizeCache protoimpl.SizeCache // A compilation error at this line likely means your copy of the
unknownFields protoimpl.UnknownFields // proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
OperationID string `protobuf:"bytes,1,opt,name=operationID,proto3" json:"operationID,omitempty"` type PushMsgReq struct {
MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData,proto3" json:"msgData,omitempty"` OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"`
PushToUserID string `protobuf:"bytes,3,opt,name=pushToUserID,proto3" json:"pushToUserID,omitempty"` MsgData *sdk_ws.MsgData `protobuf:"bytes,2,opt,name=msgData" json:"msgData,omitempty"`
PushToUserID string `protobuf:"bytes,3,opt,name=pushToUserID" json:"pushToUserID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (x *PushMsgReq) Reset() { func (m *PushMsgReq) Reset() { *m = PushMsgReq{} }
*x = PushMsgReq{} func (m *PushMsgReq) String() string { return proto.CompactTextString(m) }
if protoimpl.UnsafeEnabled { func (*PushMsgReq) ProtoMessage() {}
mi := &file_push_push_proto_msgTypes[0] func (*PushMsgReq) Descriptor() ([]byte, []int) {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) return fileDescriptor_push_17f752d1b1c8edd5, []int{0}
ms.StoreMessageInfo(mi)
}
} }
func (m *PushMsgReq) XXX_Unmarshal(b []byte) error {
func (x *PushMsgReq) String() string { return xxx_messageInfo_PushMsgReq.Unmarshal(m, b)
return protoimpl.X.MessageStringOf(x)
} }
func (m *PushMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
func (*PushMsgReq) ProtoMessage() {} return xxx_messageInfo_PushMsgReq.Marshal(b, m, deterministic)
func (x *PushMsgReq) ProtoReflect() protoreflect.Message {
mi := &file_push_push_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
} }
func (dst *PushMsgReq) XXX_Merge(src proto.Message) {
// Deprecated: Use PushMsgReq.ProtoReflect.Descriptor instead. xxx_messageInfo_PushMsgReq.Merge(dst, src)
func (*PushMsgReq) Descriptor() ([]byte, []int) { }
return file_push_push_proto_rawDescGZIP(), []int{0} func (m *PushMsgReq) XXX_Size() int {
return xxx_messageInfo_PushMsgReq.Size(m)
} }
func (m *PushMsgReq) XXX_DiscardUnknown() {
xxx_messageInfo_PushMsgReq.DiscardUnknown(m)
}
var xxx_messageInfo_PushMsgReq proto.InternalMessageInfo
func (x *PushMsgReq) GetOperationID() string { func (m *PushMsgReq) GetOperationID() string {
if x != nil { if m != nil {
return x.OperationID return m.OperationID
} }
return "" return ""
} }
func (x *PushMsgReq) GetMsgData() *sdk_ws.MsgData { func (m *PushMsgReq) GetMsgData() *sdk_ws.MsgData {
if x != nil { if m != nil {
return x.MsgData return m.MsgData
} }
return nil return nil
} }
func (x *PushMsgReq) GetPushToUserID() string { func (m *PushMsgReq) GetPushToUserID() string {
if x != nil { if m != nil {
return x.PushToUserID return m.PushToUserID
} }
return "" return ""
} }
type PushMsgResp struct { type PushMsgResp struct {
state protoimpl.MessageState ResultCode int32 `protobuf:"varint,1,opt,name=ResultCode" json:"ResultCode,omitempty"`
sizeCache protoimpl.SizeCache XXX_NoUnkeyedLiteral struct{} `json:"-"`
unknownFields protoimpl.UnknownFields XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
ResultCode int32 `protobuf:"varint,1,opt,name=ResultCode,proto3" json:"ResultCode,omitempty"` func (m *PushMsgResp) Reset() { *m = PushMsgResp{} }
func (m *PushMsgResp) String() string { return proto.CompactTextString(m) }
func (*PushMsgResp) ProtoMessage() {}
func (*PushMsgResp) Descriptor() ([]byte, []int) {
return fileDescriptor_push_17f752d1b1c8edd5, []int{1}
}
func (m *PushMsgResp) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PushMsgResp.Unmarshal(m, b)
} }
func (m *PushMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_PushMsgResp.Marshal(b, m, deterministic)
}
func (dst *PushMsgResp) XXX_Merge(src proto.Message) {
xxx_messageInfo_PushMsgResp.Merge(dst, src)
}
func (m *PushMsgResp) XXX_Size() int {
return xxx_messageInfo_PushMsgResp.Size(m)
}
func (m *PushMsgResp) XXX_DiscardUnknown() {
xxx_messageInfo_PushMsgResp.DiscardUnknown(m)
}
var xxx_messageInfo_PushMsgResp proto.InternalMessageInfo
func (x *PushMsgResp) Reset() { func (m *PushMsgResp) GetResultCode() int32 {
*x = PushMsgResp{} if m != nil {
if protoimpl.UnsafeEnabled { return m.ResultCode
mi := &file_push_push_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
} }
return 0
} }
func (x *PushMsgResp) String() string { type DelUserPushTokenReq struct {
return protoimpl.X.MessageStringOf(x) OperationID string `protobuf:"bytes,1,opt,name=operationID" json:"operationID,omitempty"`
UserID string `protobuf:"bytes,2,opt,name=userID" json:"userID,omitempty"`
PlatformID int32 `protobuf:"varint,3,opt,name=platformID" json:"platformID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (*PushMsgResp) ProtoMessage() {} func (m *DelUserPushTokenReq) Reset() { *m = DelUserPushTokenReq{} }
func (m *DelUserPushTokenReq) String() string { return proto.CompactTextString(m) }
func (*DelUserPushTokenReq) ProtoMessage() {}
func (*DelUserPushTokenReq) Descriptor() ([]byte, []int) {
return fileDescriptor_push_17f752d1b1c8edd5, []int{2}
}
func (m *DelUserPushTokenReq) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DelUserPushTokenReq.Unmarshal(m, b)
}
func (m *DelUserPushTokenReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DelUserPushTokenReq.Marshal(b, m, deterministic)
}
func (dst *DelUserPushTokenReq) XXX_Merge(src proto.Message) {
xxx_messageInfo_DelUserPushTokenReq.Merge(dst, src)
}
func (m *DelUserPushTokenReq) XXX_Size() int {
return xxx_messageInfo_DelUserPushTokenReq.Size(m)
}
func (m *DelUserPushTokenReq) XXX_DiscardUnknown() {
xxx_messageInfo_DelUserPushTokenReq.DiscardUnknown(m)
}
func (x *PushMsgResp) ProtoReflect() protoreflect.Message { var xxx_messageInfo_DelUserPushTokenReq proto.InternalMessageInfo
mi := &file_push_push_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { func (m *DelUserPushTokenReq) GetOperationID() string {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if m != nil {
if ms.LoadMessageInfo() == nil { return m.OperationID
ms.StoreMessageInfo(mi)
}
return ms
} }
return mi.MessageOf(x) return ""
} }
// Deprecated: Use PushMsgResp.ProtoReflect.Descriptor instead. func (m *DelUserPushTokenReq) GetUserID() string {
func (*PushMsgResp) Descriptor() ([]byte, []int) { if m != nil {
return file_push_push_proto_rawDescGZIP(), []int{1} return m.UserID
}
return ""
} }
func (x *PushMsgResp) GetResultCode() int32 { func (m *DelUserPushTokenReq) GetPlatformID() int32 {
if x != nil { if m != nil {
return x.ResultCode return m.PlatformID
} }
return 0 return 0
} }
var File_push_push_proto protoreflect.FileDescriptor type DelUserPushTokenResp struct {
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
var file_push_push_proto_rawDesc = []byte{ ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
0x0a, 0x0f, 0x70, 0x75, 0x73, 0x68, 0x2f, 0x70, 0x75, 0x73, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, XXX_NoUnkeyedLiteral struct{} `json:"-"`
0x6f, 0x12, 0x04, 0x70, 0x75, 0x73, 0x68, 0x1a, 0x28, 0x4f, 0x70, 0x65, 0x6e, 0x2d, 0x49, 0x4d, XXX_unrecognized []byte `json:"-"`
0x2d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, XXX_sizecache int32 `json:"-"`
0x6f, 0x2f, 0x73, 0x64, 0x6b, 0x5f, 0x77, 0x73, 0x2f, 0x77, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, }
0x6f, 0x22, 0x88, 0x01, 0x0a, 0x0a, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71,
0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x44, 0x12, 0x34, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x61, 0x70, 0x69,
0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x61, 0x74, 0x61, 0x52,
0x07, 0x6d, 0x73, 0x67, 0x44, 0x61, 0x74, 0x61, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x75, 0x73, 0x68,
0x54, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
0x70, 0x75, 0x73, 0x68, 0x54, 0x6f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x2d, 0x0a, 0x0b,
0x50, 0x75, 0x73, 0x68, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x52,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0a, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x40, 0x0a, 0x0e, 0x50,
0x75, 0x73, 0x68, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2e, 0x0a,
0x07, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x73, 0x67, 0x12, 0x10, 0x2e, 0x70, 0x75, 0x73, 0x68, 0x2e,
0x50, 0x75, 0x73, 0x68, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x70, 0x75, 0x73,
0x68, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x73, 0x70, 0x42, 0x1f, 0x5a,
0x1d, 0x4f, 0x70, 0x65, 0x6e, 0x5f, 0x49, 0x4d, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x70, 0x75, 0x73, 0x68, 0x3b, 0x70, 0x62, 0x50, 0x75, 0x73, 0x68, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_push_push_proto_rawDescOnce sync.Once
file_push_push_proto_rawDescData = file_push_push_proto_rawDesc
)
func file_push_push_proto_rawDescGZIP() []byte { func (m *DelUserPushTokenResp) Reset() { *m = DelUserPushTokenResp{} }
file_push_push_proto_rawDescOnce.Do(func() { func (m *DelUserPushTokenResp) String() string { return proto.CompactTextString(m) }
file_push_push_proto_rawDescData = protoimpl.X.CompressGZIP(file_push_push_proto_rawDescData) func (*DelUserPushTokenResp) ProtoMessage() {}
}) func (*DelUserPushTokenResp) Descriptor() ([]byte, []int) {
return file_push_push_proto_rawDescData return fileDescriptor_push_17f752d1b1c8edd5, []int{3}
} }
func (m *DelUserPushTokenResp) XXX_Unmarshal(b []byte) error {
var file_push_push_proto_msgTypes = make([]protoimpl.MessageInfo, 2) return xxx_messageInfo_DelUserPushTokenResp.Unmarshal(m, b)
var file_push_push_proto_goTypes = []interface{}{ }
(*PushMsgReq)(nil), // 0: push.PushMsgReq func (m *DelUserPushTokenResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
(*PushMsgResp)(nil), // 1: push.PushMsgResp return xxx_messageInfo_DelUserPushTokenResp.Marshal(b, m, deterministic)
(*sdk_ws.MsgData)(nil), // 2: server_api_params.MsgData }
} func (dst *DelUserPushTokenResp) XXX_Merge(src proto.Message) {
var file_push_push_proto_depIdxs = []int32{ xxx_messageInfo_DelUserPushTokenResp.Merge(dst, src)
2, // 0: push.PushMsgReq.msgData:type_name -> server_api_params.MsgData }
0, // 1: push.PushMsgService.PushMsg:input_type -> push.PushMsgReq func (m *DelUserPushTokenResp) XXX_Size() int {
1, // 2: push.PushMsgService.PushMsg:output_type -> push.PushMsgResp return xxx_messageInfo_DelUserPushTokenResp.Size(m)
2, // [2:3] is the sub-list for method output_type }
1, // [1:2] is the sub-list for method input_type func (m *DelUserPushTokenResp) XXX_DiscardUnknown() {
1, // [1:1] is the sub-list for extension type_name xxx_messageInfo_DelUserPushTokenResp.DiscardUnknown(m)
1, // [1:1] is the sub-list for extension extendee }
0, // [0:1] is the sub-list for field type_name
} var xxx_messageInfo_DelUserPushTokenResp proto.InternalMessageInfo
func init() { file_push_push_proto_init() } func (m *DelUserPushTokenResp) GetErrCode() int32 {
func file_push_push_proto_init() { if m != nil {
if File_push_push_proto != nil { return m.ErrCode
return
}
if !protoimpl.UnsafeEnabled {
file_push_push_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PushMsgReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_push_push_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PushMsgResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
} }
return 0
}
func (m *DelUserPushTokenResp) GetErrMsg() string {
if m != nil {
return m.ErrMsg
} }
type x struct{} return ""
out := protoimpl.TypeBuilder{ }
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), func init() {
RawDescriptor: file_push_push_proto_rawDesc, proto.RegisterType((*PushMsgReq)(nil), "push.PushMsgReq")
NumEnums: 0, proto.RegisterType((*PushMsgResp)(nil), "push.PushMsgResp")
NumMessages: 2, proto.RegisterType((*DelUserPushTokenReq)(nil), "push.DelUserPushTokenReq")
NumExtensions: 0, proto.RegisterType((*DelUserPushTokenResp)(nil), "push.DelUserPushTokenResp")
NumServices: 1,
},
GoTypes: file_push_push_proto_goTypes,
DependencyIndexes: file_push_push_proto_depIdxs,
MessageInfos: file_push_push_proto_msgTypes,
}.Build()
File_push_push_proto = out.File
file_push_push_proto_rawDesc = nil
file_push_push_proto_goTypes = nil
file_push_push_proto_depIdxs = nil
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
var _ context.Context var _ context.Context
var _ grpc.ClientConnInterface var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6 const _ = grpc.SupportPackageIsVersion4
// Client API for PushMsgService service
// PushMsgServiceClient is the client API for PushMsgService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type PushMsgServiceClient interface { type PushMsgServiceClient interface {
PushMsg(ctx context.Context, in *PushMsgReq, opts ...grpc.CallOption) (*PushMsgResp, error) PushMsg(ctx context.Context, in *PushMsgReq, opts ...grpc.CallOption) (*PushMsgResp, error)
DelUserPushToken(ctx context.Context, in *DelUserPushTokenReq, opts ...grpc.CallOption) (*DelUserPushTokenResp, error)
} }
type pushMsgServiceClient struct { type pushMsgServiceClient struct {
cc grpc.ClientConnInterface cc *grpc.ClientConn
} }
func NewPushMsgServiceClient(cc grpc.ClientConnInterface) PushMsgServiceClient { func NewPushMsgServiceClient(cc *grpc.ClientConn) PushMsgServiceClient {
return &pushMsgServiceClient{cc} return &pushMsgServiceClient{cc}
} }
func (c *pushMsgServiceClient) PushMsg(ctx context.Context, in *PushMsgReq, opts ...grpc.CallOption) (*PushMsgResp, error) { func (c *pushMsgServiceClient) PushMsg(ctx context.Context, in *PushMsgReq, opts ...grpc.CallOption) (*PushMsgResp, error) {
out := new(PushMsgResp) out := new(PushMsgResp)
err := c.cc.Invoke(ctx, "/push.PushMsgService/PushMsg", in, out, opts...) err := grpc.Invoke(ctx, "/push.PushMsgService/PushMsg", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return out, nil return out, nil
} }
// PushMsgServiceServer is the server API for PushMsgService service. func (c *pushMsgServiceClient) DelUserPushToken(ctx context.Context, in *DelUserPushTokenReq, opts ...grpc.CallOption) (*DelUserPushTokenResp, error) {
type PushMsgServiceServer interface { out := new(DelUserPushTokenResp)
PushMsg(context.Context, *PushMsgReq) (*PushMsgResp, error) err := grpc.Invoke(ctx, "/push.PushMsgService/DelUserPushToken", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
} }
// UnimplementedPushMsgServiceServer can be embedded to have forward compatible implementations. // Server API for PushMsgService service
type UnimplementedPushMsgServiceServer struct {
}
func (*UnimplementedPushMsgServiceServer) PushMsg(context.Context, *PushMsgReq) (*PushMsgResp, error) { type PushMsgServiceServer interface {
return nil, status.Errorf(codes.Unimplemented, "method PushMsg not implemented") PushMsg(context.Context, *PushMsgReq) (*PushMsgResp, error)
DelUserPushToken(context.Context, *DelUserPushTokenReq) (*DelUserPushTokenResp, error)
} }
func RegisterPushMsgServiceServer(s *grpc.Server, srv PushMsgServiceServer) { func RegisterPushMsgServiceServer(s *grpc.Server, srv PushMsgServiceServer) {
@ -310,6 +293,24 @@ func _PushMsgService_PushMsg_Handler(srv interface{}, ctx context.Context, dec f
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _PushMsgService_DelUserPushToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DelUserPushTokenReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PushMsgServiceServer).DelUserPushToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/push.PushMsgService/DelUserPushToken",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PushMsgServiceServer).DelUserPushToken(ctx, req.(*DelUserPushTokenReq))
}
return interceptor(ctx, in, info, handler)
}
var _PushMsgService_serviceDesc = grpc.ServiceDesc{ var _PushMsgService_serviceDesc = grpc.ServiceDesc{
ServiceName: "push.PushMsgService", ServiceName: "push.PushMsgService",
HandlerType: (*PushMsgServiceServer)(nil), HandlerType: (*PushMsgServiceServer)(nil),
@ -318,7 +319,39 @@ var _PushMsgService_serviceDesc = grpc.ServiceDesc{
MethodName: "PushMsg", MethodName: "PushMsg",
Handler: _PushMsgService_PushMsg_Handler, Handler: _PushMsgService_PushMsg_Handler,
}, },
{
MethodName: "DelUserPushToken",
Handler: _PushMsgService_DelUserPushToken_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "push/push.proto", Metadata: "push/push.proto",
} }
func init() { proto.RegisterFile("push/push.proto", fileDescriptor_push_17f752d1b1c8edd5) }
var fileDescriptor_push_17f752d1b1c8edd5 = []byte{
// 342 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0x4f, 0x4b, 0xfb, 0x40,
0x10, 0x25, 0xfd, 0xfd, 0xda, 0xe2, 0x54, 0xb4, 0xae, 0x22, 0x31, 0xa0, 0x96, 0x9c, 0x7a, 0x69,
0x02, 0xd5, 0x9b, 0x37, 0xcd, 0xc1, 0x1c, 0x82, 0x25, 0xea, 0xc5, 0x4b, 0xd8, 0xda, 0x35, 0x2d,
0xfd, 0xb3, 0xe3, 0x4e, 0x62, 0xbf, 0x82, 0xe0, 0x97, 0x96, 0xdd, 0x24, 0x1a, 0xab, 0x82, 0x97,
0x65, 0xe7, 0xcd, 0xdb, 0x79, 0x6f, 0x76, 0x06, 0x76, 0x31, 0xa7, 0xa9, 0xaf, 0x0f, 0x0f, 0x95,
0xcc, 0x24, 0xfb, 0xaf, 0xef, 0x4e, 0xff, 0x06, 0xc5, 0x6a, 0x10, 0x46, 0x83, 0x5b, 0xa1, 0x5e,
0x84, 0xf2, 0x71, 0x9e, 0xfa, 0x26, 0xef, 0xd3, 0x64, 0x9e, 0xac, 0xc9, 0x5f, 0x53, 0xc1, 0x77,
0x5f, 0x2d, 0x80, 0x51, 0x4e, 0xd3, 0x88, 0xd2, 0x58, 0x3c, 0xb3, 0x1e, 0x74, 0x24, 0x0a, 0xc5,
0xb3, 0x99, 0x5c, 0x85, 0x81, 0x6d, 0xf5, 0xac, 0xfe, 0x56, 0x5c, 0x87, 0xd8, 0x39, 0xb4, 0x97,
0x94, 0x06, 0x3c, 0xe3, 0x76, 0xa3, 0x67, 0xf5, 0x3b, 0x43, 0xc7, 0x23, 0x23, 0x92, 0x70, 0x9c,
0x25, 0xc8, 0x15, 0x5f, 0x92, 0x17, 0x15, 0x8c, 0xb8, 0xa2, 0x32, 0x17, 0xb6, 0xb5, 0xb1, 0x3b,
0x79, 0x4f, 0x42, 0x85, 0x81, 0xfd, 0xcf, 0x14, 0xfe, 0x82, 0xb9, 0x03, 0xe8, 0x7c, 0x38, 0x21,
0x64, 0x27, 0x00, 0xb1, 0xa0, 0x7c, 0x91, 0x5d, 0xc9, 0x89, 0x30, 0x4e, 0x9a, 0x71, 0x0d, 0x71,
0x25, 0xec, 0x07, 0x62, 0xa1, 0xdf, 0x8e, 0x4c, 0x95, 0xb9, 0x58, 0xfd, 0xad, 0x83, 0x43, 0x68,
0xe5, 0x85, 0x8b, 0x86, 0x49, 0x96, 0x91, 0x16, 0xc4, 0x05, 0xcf, 0x9e, 0xa4, 0x5a, 0x96, 0x0e,
0x9b, 0x71, 0x0d, 0x71, 0xaf, 0xe1, 0xe0, 0xbb, 0x20, 0x21, 0xb3, 0xa1, 0x2d, 0x94, 0xaa, 0xb9,
0xac, 0x42, 0xad, 0x24, 0x94, 0x8a, 0x28, 0xad, 0x94, 0x8a, 0x68, 0xf8, 0x66, 0xc1, 0x4e, 0xd9,
0xaa, 0x1e, 0xd0, 0xec, 0x51, 0x30, 0x0f, 0xda, 0x25, 0xc2, 0xba, 0x9e, 0x99, 0xe7, 0xe7, 0x54,
0x9c, 0xbd, 0x0d, 0x84, 0x90, 0x85, 0xd0, 0xdd, 0x34, 0xc3, 0x8e, 0x0a, 0xda, 0x0f, 0xbf, 0xe2,
0x38, 0xbf, 0xa5, 0x08, 0x2f, 0x4f, 0x1f, 0x8e, 0xf5, 0xba, 0x24, 0x61, 0x54, 0xdb, 0x13, 0x4d,
0xbf, 0xc0, 0xb1, 0x66, 0x8e, 0x5b, 0x06, 0x3a, 0x7b, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x44,
0x0e, 0xd2, 0x6d, 0x02, 0x00, 0x00,
}

@ -11,6 +11,16 @@ message PushMsgReq {
message PushMsgResp{ message PushMsgResp{
int32 ResultCode = 1; int32 ResultCode = 1;
} }
message DelUserPushTokenReq{
string operationID = 1;
string userID =2;
int32 platformID = 3;
}
message DelUserPushTokenResp{
int32 errCode = 1;
string errMsg = 2;
}
//message InternalPushMsgReq{ //message InternalPushMsgReq{
// int32 ReqIdentifier = 1; // int32 ReqIdentifier = 1;
// string Token = 2; // string Token = 2;
@ -33,6 +43,7 @@ message PushMsgResp{
service PushMsgService { service PushMsgService {
rpc PushMsg(PushMsgReq) returns(PushMsgResp); rpc PushMsg(PushMsgReq) returns(PushMsgResp);
rpc DelUserPushToken(DelUserPushTokenReq) returns(DelUserPushTokenResp);
// rpc InternalPushMsg(InternalPushMsgReq)returns(PushMsgResp); // rpc InternalPushMsg(InternalPushMsgReq)returns(PushMsgResp);
} }

Loading…
Cancel
Save