# How to handle client ids in Flower Next apps?

**URL:** https://discuss.flower.ai/t/how-to-handle-client-ids-in-flower-next-apps/181
**Category:** Flower Help - Intermediate
**Tags:** simulation
**Created:** [March 22, 2024, 2:19pm UTC](https://discuss.flower.ai/t/how-to-handle-client-ids-in-flower-next-apps/181 "2024-03-22T14:19:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pwiesner](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pwiesner](https://discuss.flower.ai/u/pwiesner)
#### Post date: [March 22, 2024, 2:19pm UTC](https://discuss.flower.ai/t/how-to-handle-client-ids-in-flower-next-apps/181/1 "2024-03-22T14:19:15Z")

</div>

Hi!

I’m trying out the new flower interface based on ServerApp/ClientApp. The old [`start_simulation`](https://flower.ai/docs/framework/ref-api/flwr.simulation.start_simulation.html#flwr.simulation.start_simulation) interface allowed providing a list of `clients_ids` which where then passed to `client_fn` and were also available in the server’s `ClientManager`.

The new [`run_simulation`](https://flower.ai/docs/framework/ref-api/flwr.simulation.run_simulation.html#flwr.simulation.run_simulation) provides no such option and returns different identifiers in the mentioned entities. The `cid` passed to `client_fn` seems to be the internally generated `partition_id`. However, the mapping to `DriverClientProxy` in `ClientManager.clients` uses some other type of internally generated id.

Is there any way to map from these different types of ids at this point? I’m implementing a custom scheduler and did not yet find a way to do so as the ids in `DriverClientProxy` are generated after simulation start.

Thanks!

---

<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: [March 22, 2024, 6:13pm UTC](https://discuss.flower.ai/t/how-to-handle-client-ids-in-flower-next-apps/181/2 "2024-03-22T18:13:50Z")

</div>

Hi @pwiesner, this is a feature we definitively want to add to the new Simulation Engine. This will be possible by passing a custom `state_factory` that comes with some pre-registered nodes and `node-id:partition-id` mapping. The [code base](https://github.com/adap/flower/blob/4041299b4d75eb478a65e71ac21fe7e3f77ec2fb/src/py/flwr/server/superlink/fleet/vce/vce_api.py#L231) is ready for this but is not exposed to higher-level APIs. It’d require you to pass a node mapping as opposed to creating it before starting the simulation (which essentially mirrors the functionality you are familiar with via `start_simulation`)

For now I think you are going to get a better experience using the `start_simulation` approach, while we complete some optimizations and better API that will be ready when FLower Next gets fully launched in a couple of months.

---

<div class="post-metadata">

### Author: ![pwiesner](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pwiesner](https://discuss.flower.ai/u/pwiesner)
#### Post date: [March 22, 2024, 7:05pm UTC](https://discuss.flower.ai/t/how-to-handle-client-ids-in-flower-next-apps/181/3 "2024-03-22T19:05:09Z")

</div>

Amazing, thanks for the fast reply! Then I’ll try to find some workaround for now and wait until you introduce the new argument in a future release 🙂

---

<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: [March 29, 2024, 7:05pm UTC](https://discuss.flower.ai/t/how-to-handle-client-ids-in-flower-next-apps/181/4 "2024-03-29T19:05:57Z")

</div>

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