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