You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/common/check/msg.go

27 lines
596 B

package check
import (
"Open_IM/pkg/common/config"
discoveryRegistry "Open_IM/pkg/discoveryregistry"
"Open_IM/pkg/proto/msg"
"context"
"google.golang.org/grpc"
)
type MsgCheck struct {
zk discoveryRegistry.SvcDiscoveryRegistry
}
func (m *MsgCheck) getConn() (*grpc.ClientConn, error) {
return m.zk.GetConn(config.Config.RpcRegisterName.OpenImMsgName)
}
func (m *MsgCheck) SendMsg(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error) {
cc, err := m.getConn()
if err != nil {
return nil, err
}
resp, err := msg.NewMsgClient(cc).SendMsg(ctx, req)
return resp, err
}