mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 20:30:40 +08:00
31 lines
801 B
Go
31 lines
801 B
Go
package rpcclient
|
|
|
|
import (
|
|
"context"
|
|
|
|
"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
|
|
}
|
|
|
|
func NewPushClient(discov discoveryregistry.SvcDiscoveryRegistry) *PushClient {
|
|
conn, err := discov.GetConn(context.Background(), config.Config.RpcRegisterName.OpenImPushName)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
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)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|