client.go 455 B

123456789101112131415161718192021222324
  1. package v1
  2. import (
  3. "context"
  4. "go-common/library/net/rpc/warden"
  5. "google.golang.org/grpc"
  6. )
  7. // .
  8. const (
  9. DiscoveryID = "push.service.broadcast"
  10. )
  11. // NewClient .
  12. func NewClient(conf *warden.ClientConfig, opts ...grpc.DialOption) (ZergClient, error) {
  13. client := warden.NewClient(conf, opts...)
  14. cc, err := client.Dial(context.Background(), "discovery://default/"+DiscoveryID)
  15. if err != nil {
  16. return nil, err
  17. }
  18. return NewZergClient(cc), nil
  19. }