25 lines
662 B
Go
25 lines
662 B
Go
package grpcclient
|
|
|
|
import (
|
|
"git.hlsq.asia/alex/service-common/discover"
|
|
"git.hlsq.asia/alex/service-common/discover/common"
|
|
"git.hlsq.asia/alex/service-common/proto/rs/rspb"
|
|
)
|
|
|
|
func GatewayNewClient(sid ...int64) (rspb.GatewayClient, error) {
|
|
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return rspb.NewGatewayClient(c), nil
|
|
}
|
|
|
|
func GatewayNewBroadcastClient() map[int64]rspb.GatewayClient {
|
|
clientM := make(map[int64]rspb.GatewayClient)
|
|
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
|
for sid, conn := range connM {
|
|
clientM[sid] = rspb.NewGatewayClient(conn)
|
|
}
|
|
return clientM
|
|
}
|