Hi - I’ve tried sending { handle: null }, { handle: undefined }, and {} as sessionResumption in Gemini Live API. But I’m still not getting `message.sessionResumptionUpdate`, even after I speak to it. This is true in both audio modes (half cascade and full native).
Hi @M_L
This isn’t expected behavior; the server is obligated to return a sessionResumptionUpdate if the key exists, which suggests your SDK might be silently stripping the null value during serialization.
Could you please share the code snippet where you construct the setup object and your WebSocket message listener loop?
Hi @Pannaga_J . Thank you for your repsonse. Here’s the message sent to Chrome (you can see the sessionResumption key being sent). However, I do not get the message.sessionResumptionUpdate field back.
From my experience, the session resumption token is not sent every time or on every turn. It may only appear later in the conversation, especially when the context becomes larger and the service decides it’s needed.
Just sharing this in case it helps someone who is debugging the same behavior.
Thank you @icapora . I can have a whole conversation with the live API (hundreds of messages from gemini live) without yet seeing the message.sessionResumptionUpdate set. Is that expected?
Hey @Kristina_Fontanez just to clarify (and with a bit of a smile ): I’m not a Google employee, just another developer running into the same issue.
So I don’t have any visibility into timelines or internal roadmaps — I just shared my experience/workaround here so others can compare notes and hopefully someone from the actual Google team can jump in with an official update.
When you’re using ephemeral tokens, the model runs in a restricted mode. To get session resumption working, you actually have to authorize it on your backend first. You will need to add session_resumption: {} inside the live_connect_constraints block when you call authTokens.create. If the token itself does not have that permission, the server will just ignore the request from the client side. You can check out the best practices for ephemeral tokens here for more details.
Server does not send the sessionResumptionUpdate right when you connect. It usually waits until there has been at least one meaningful back-and-forth, like a full sentence of audio or text, so it has a solid state to checkpoint. Once that first turn is totally finished, you should see the handle pop up. Please refer here for a good breakdown of how sessions are managed and resumed here.
Thank you for explaining this @Srikanta_K_N and thank you for the link to the documents. I can confirm that this works.
It’s not obvious from the API documents that you need to set a config when creating an ephemeral token. Also, we look at the tutorials rather than API pages. Could you update these pages for future users: