go-common/app/service/live/broadcast-proxy/api/v1/client.go

26 lines
537 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package v1
import (
"context"
"go-common/library/net/rpc/warden"
"google.golang.org/grpc"
)
const kAppID = "live.broadcastproxy"
type Client struct {
DanmakuClient
}
// NewClient new resource grpc client
func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (*Client, error) {
client := warden.NewClient(cfg, opts...)
conn, err := client.Dial(context.Background(), "discovery://default/"+kAppID)
if err != nil {
return nil, err
}
cli := &Client{}
cli.DanmakuClient = NewDanmakuClient(conn)
return cli, nil
}