client.go 474 B

1234567891011121314151617181920212223
  1. package v1
  2. import (
  3. "context"
  4. "go-common/library/net/rpc/warden"
  5. "google.golang.org/grpc"
  6. )
  7. //AppID 弹幕服务discoverID
  8. const AppID = "live.livedm"
  9. //NewClient 弹幕服务client创建
  10. func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (DMClient, error) {
  11. client := warden.NewClient(cfg, opts...)
  12. conn, err := client.Dial(context.Background(), "discovery://default/"+AppID)
  13. if err != nil {
  14. return nil, err
  15. }
  16. return NewDMClient(conn), nil
  17. }