25 lines
597 B
Go
25 lines
597 B
Go
package service
|
|
|
|
import (
|
|
"common/discover"
|
|
"common/discover/common"
|
|
"common/discover/service/game/game_pb"
|
|
)
|
|
|
|
func GatewayNewClient(sid ...string) (game_pb.GameClient, error) {
|
|
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return game_pb.NewGameClient(c), nil
|
|
}
|
|
|
|
func GatewayNewBroadcastClient() map[string]game_pb.GameClient {
|
|
clientM := make(map[string]game_pb.GameClient)
|
|
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
|
for sid, conn := range connM {
|
|
clientM[sid] = game_pb.NewGameClient(conn)
|
|
}
|
|
return clientM
|
|
}
|