go-common/app/service/live/rtc/api/v1/client.go
2019-04-22 18:49:16 +08:00

26 lines
514 B
Go

package v1
import (
"context"
"go-common/library/net/rpc/warden"
"google.golang.org/grpc"
)
const kAppID = "live.rtc"
type Client struct {
RtcClient
}
// 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.RtcClient = NewRtcClient(conn)
return cli, nil
}