Skip to content

Hrana WebSocket support (JSON, then Protobuf) #189

Closed
2 of 2 issues completed
Closed

Description

@magnusp

Goal

Let libsql-java speak Hrana 3 over WebSocket. A JDBC connection can then keep one multiplexed connection to sqld, instead of making one HTTP request per pipeline.

Phases

Cross-cutting requirements

Both phases share a seam that does not exist yet. Today LibsqlConnection depends directly on the concrete LibsqlHttpClient and on the HTTP baton as its source of truth for "is a stream open". WebSocket has no baton — the client assigns a stream_id. Phase 1 introduces a stream-level seam (open / execute / batch / close, with error mapping) implemented by both the HTTP client (baton) and the WebSocket client (stream_id), and migrates LibsqlConnection to it. Phase 2 reuses that seam and swaps only the frame encoding.

Sequencing

Phase 2 starts only after phase 1 is merged.

Source of truth and outside check

  • Protocol: vendor/HRANA_3_SPEC.md, section "Hrana over WebSocket".
  • Behavior: integration tests against the pinned sqld image (libsql.image in the root pom.xml), which is independent of this codebase.

Done when

  • Both phases are merged.
  • The integration tests run JDBC over WebSocket in both encodings against sqld.
  • The HTTP transport is unchanged, and its conformance and integration tests still pass.

Activity

  1. magnusp commented on Oct 24, 2026

    @magnusp
    OwnerAuthor

    Both phases are merged.

    The transport seam (LibsqlClient) is in place, LibsqlConnection no longer depends on the HTTP client, and LibsqlDriver selects the transport and encoding from the URL. The HTTP transport is unchanged.

    Verified on merged main (6591155): 374 unit tests pass, spotless:check passes, and WebSocket*TransportIT passes 8 of 8 against the pinned sqld image (5 JSON, 3 Protobuf).

    Remaining limits are recorded in #188: wss has no TLS integration test, and Protobuf over HTTP and Hrana cursors are out of scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions