# share custom data between the server and one client

**URL:** <https://discuss.flower.ai/t/share-custom-data-between-the-server-and-one-client/1081>\
**Category:** Flower Help - Intermediate\
**Created:** [August 18, 2025, 9:25am UTC](https://discuss.flower.ai/t/share-custom-data-between-the-server-and-one-client/1081 "2025-08-18T09:25:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gm000](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@gm000](https://discuss.flower.ai/u/gm000)\
**Post date:** [August 18, 2025, 9:25am UTC](https://discuss.flower.ai/t/share-custom-data-between-the-server-and-one-client/1081/1 "2025-08-18T09:25:50Z")

</div>

Hi everyone,

I need to pass some initialization parameters to the client class and use them within its init method. Is there an easy way to send custom information from the server to the client at this point? I mean I know about callbacks which fit\_config and evaluate\_config but I need to have my information available within the init.

PS likely these information come from command line params passed when the main is run, then the main passes them to the server but I cannot send them to all clients

Thanks a lot for the usual great support.

---

<div class="post-metadata">

**Author:** ![javier](https://dub1.discourse-cdn.com/flex013/user_avatar/discuss.flower.ai/javier/32/116_2.png) [@javier](https://discuss.flower.ai/u/javier)\
**Post date:** [August 18, 2025, 9:34am UTC](https://discuss.flower.ai/t/share-custom-data-between-the-server-and-one-client/1081/2 "2025-08-18T09:34:49Z")

</div>

Hey @gm000 ,

Great question! One of the best ways to pass configs to initialize your Clients is via either the _run config_ or the _node config_.

I’m assuming you are familiar with the [quickstart-pytorch example](https://github.com/adap/flower/tree/main/examples/quickstart-pytorch) in the Flower repo. The `client_fn` function instantiates your Client. Note that this function receives as input argument an object of type `Context`. You can read the run config as shown below.

```auto
def client_fn(context: Context):
    """Construct a Client that will be run in a ClientApp."""

    ...

    # Read the "batch-size" config from the Run config
    batch_size = context.run_config["batch-size"]
    learning_rate = context.run_config["learning-rate"]

    # Instantiate your client
    return FlowerClient(...)

```

The above `batch_size` and `learning_rate` that are in the run config are defined in the `pyproject.toml` of your Flower App. If you inspect such file from the example you’ll see:

```auto

[tool.flwr.app.config]
num-server-rounds = 3
fraction-evaluate = 0.5
local-epochs = 1
learning-rate = 0.1
batch-size = 32

```

You can ofcourse change those values. Note none of these values are compulsory in Flower. So may add more (e.g. L2 regularization) if you want your ClientApp to make use of it during training – but for that you also need to implement the code.

I hope this helps!!

PS: the other way of passing configs is via the _node config_. Note that this is only possible when using Flower’ deployment engine (i.e. it’s not possible during simulation). With the deployment engine you’ll set a node config like this:

```auto
flower-supernode <args> --node-config="path-to-data='....' another-arg=123"

```

and your `ClientApp` will be able to read that info at run time via `context.node_config`

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/flower/original/1X/bc7fe36843c391cbd0b4e8b6f48275961d356abc.png) [@system](https://discuss.flower.ai/u/system)\
**Post date:** [August 25, 2025, 11:52am UTC](https://discuss.flower.ai/t/share-custom-data-between-the-server-and-one-client/1081/3 "2025-08-25T11:52:07Z")

</div>

Closed on August 25, 2025, 11:52am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
