This commit is contained in:
wangchuxiao
2023-06-01 21:28:16 +08:00
parent a641f44486
commit ff7b6e200c
9 changed files with 197 additions and 84 deletions
+12 -8
View File
@@ -6,23 +6,27 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/push"
"google.golang.org/grpc"
)
type PushClient struct {
conn *grpc.ClientConn
MetaClient
}
func NewPushClient(discov discoveryregistry.SvcDiscoveryRegistry) *PushClient {
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImPushName)
if err != nil {
panic(err)
func NewPushClient(client discoveryregistry.SvcDiscoveryRegistry) *PushClient {
return &PushClient{
MetaClient: MetaClient{
client: client,
rpcRegisterName: config.Config.RpcRegisterName.OpenImPushName,
},
}
return &PushClient{conn: conn}
}
func (p *PushClient) DelUserPushToken(ctx context.Context, req *push.DelUserPushTokenReq) (*push.DelUserPushTokenResp, error) {
resp, err := push.NewPushMsgServiceClient(p.conn).DelUserPushToken(ctx, req)
cc, err := p.getConn(ctx)
if err != nil {
return nil, err
}
resp, err := push.NewPushMsgServiceClient(cc).DelUserPushToken(ctx, req)
if err != nil {
return nil, err
}