onClientAttached property

void Function(String serverId, Client client)? onClientAttached
getter/setter pair

Called after a server's Client is replaced by a NEW one — the first connect and every reconnect alike.

State that lives on the CLIENT does not survive the swap: notification handlers and resources/subscribe are per-connection, so an open app that was streaming goes silent after a background round trip while its tool calls keep working (those resolve the live client per call). The screen looked healthy and only the stream was dead, and pressing Subscribe again did nothing because the runtime had already registered its binding. Whoever owns that state re-attaches here.

Implementation

void Function(String serverId, Client client)? onClientAttached;