usingvarclient=newGeminiClient(apiKey);try{usingvarcts=newCancellationTokenSource(TimeSpan.FromSeconds(60));// Connects with session resumption enabled, exchanges a message,// then reconnects using the resumption handle via ReconnectLiveAsync.varconfig=CreateLiveConfig();config.SessionResumption=newLiveSessionResumptionConfig();// First session: send a message and collect the resumption handle.// The handle arrives asynchronously — keep reading after turnComplete.string?resumptionHandle;awaitusing(varsession1=awaitclient.ConnectLiveAsync(config,cancellationToken:cts.Token)){awaitsession1.SendTextAsync("Remember: the secret word is banana.",cts.Token);boolturnDone=false;awaitforeach(varmessageinsession1.ReadEventsAsync(cts.Token)){if(message.ServerContent?.TurnComplete==true){turnDone=true;}// Once turn is done AND we have a handle, stopif(turnDone&&session1.LastSessionResumptionHandleis{Length:>0}){break;}}resumptionHandle=session1.LastSessionResumptionHandle;}if(string.IsNullOrEmpty(resumptionHandle)){}// Second session: reconnect using ReconnectLiveAsync.varconfig2=CreateLiveConfig();config2.SessionResumption=newLiveSessionResumptionConfig{Handle=resumptionHandle,};awaitusingvarsession2=awaitclient.ConnectLiveAsync(config2,cancellationToken:cts.Token);awaitsession2.SendTextAsync("What was the secret word?",cts.Token);boolreceivedResponse=false;awaitforeach(varmessageinsession2.ReadEventsAsync(cts.Token)){if(message.ServerContent?.ModelTurn?.Partsis{Count:>0}){receivedResponse=true;}if(message.ServerContent?.TurnComplete==true){break;}}}catch(WebSocketExceptionex){}catch(OperationCanceledException){}