Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Live API: no way to observe session close or connection errors after setup

Abierto
#1,153 1 comentario 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@hemasekhar-p ya está trabajando en esto.

Desde el 3/8/2026.

  • #1154 de @subhashpolisetti — abierto

Evaluación

Este issue todavía no se ha evaluado.

Descripción

priority: p3 type: feature request

Summary

After a Live session is established, a caller has no way to be notified that it ended. When the server closes the session (e.g. after GoAway) or the WebSocket drops, AsyncLive.GenAiWebSocketClient only logs onClosed/onFailure nothing reaches the receive() message consumer or any future, so the application can't react. receive() itself returns an already-completed future (its Javadoc notes it only signals registration), so it can't carry the signal either.

Root cause

In AsyncLive.GenAiWebSocketClient, once sessionFuture is done (i.e. for the whole active session) these just log:

public void onClosed(WebSocket webSocket, int code, String reason) {
    logger.log(Level.INFO, "Live session closed ...");
    if (!sessionFuture.isDone()) { sessionFuture.completeExceptionally(...); }  // else: only logged
}

public void onFailure(WebSocket webSocket, Throwable t, @Nullable Response response) {
    logger.log(Level.SEVERE, "Error during live session", t);
    if (!sessionFuture.isDone()) { sessionFuture.completeExceptionally(t); }    // else: only logged
}

Impact

Found while building the Gemini Live API integration for langchain4j: the wrapper can't tell the application when a session ends. A listen-only voice agent is never notified that the connection dropped the only signal today is an exception on the next send.

Suggested fix

A backward-compatible overload of receive(...), with onError/onClose invoked from onFailure/onClosed after setup (terminal, mutually exclusive, nullable); the existing receive(Consumer) delegates to it:

public CompletableFuture<Void> receive(
    Consumer<LiveServerMessage> onMessage, Consumer<Throwable> onError, Runnable onClose)

Open to a different shape (e.g. a listener interface) if you'd prefer.

Environment

com.google.genai:google-genai 1.62.0, and unchanged on current main (1.65.0-SNAPSHOT). Gemini Live API, Java.

Lenguaje dominante
Java
Estrellas
398
Forks
126
Merge medio
1 d 12 h
PR fusionados (30 d)
71

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de googleapis/java-genai

Todos los issues de googleapis/java-genai

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.