Beispiel #1
0
func CallRpc(method string, params interface{}) (interface{}, error) {
	result, err := rpc.Send(config.MasterRpc(), "RpcServer."+method, params)
	if err != nil {
		IsConnected = false
		log.Println("lose connect")
		return nil, err
	}
	return result, nil
}
Beispiel #2
0
func (r *HostClient) CallRpc(method string, params ...rpc.RpcInterface) (interface{}, error) {
	var param rpc.RpcInterface = &rpc.SimpleArgs{Id: r.Id}

	if len(params) > 0 && params[0] != nil {
		param = params[0]
		param.SetId(r.Id)
	}

	return rpc.Send(r.RpcIp(), "RpcClient."+method, param)
}