Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#1,153 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@hemasekhar-p がすでに取り組んでいます。

2026年8月3日 から。

  • #1154 @subhashpolisetti による — オープン

評価

この issue はまだ評価されていません。

説明

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.

主要言語
Java
スター
398
フォーク
126
平均マージ
1日 12時間
マージ済み PR(30日)
71

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

googleapis/java-genai のほかの issue

googleapis/java-genai の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。