Repository navigation
feat(client): add Hrana 3 Protobuf over WebSocket transport - #191
Merged
Merged
Conversation
magnusp
force-pushed
the
feat/i188-hrana-ws-protobuf
branch
from
October 24, 2026 01:59
7c52aa9 to
f5e0b41
Compare
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add the Protobuf encoding for Hrana 3 over WebSocket (
hrana3-protobufsubprotocol, binary frames). JSON stays the default. A URL ofjdbc:libsql:ws://host:port?encoding=protobufselects it.Fixes #188.
This PR is stacked on #190 and targets
feat/i187-hrana-ws-json. Merge #190 first.What changes
HranaWsProtobufCodecimplementsHranaWsCodecover the already vendoredhrana_ws.protoandhrana.protoschemas. It mapsStmt,Value,Batch,BatchCond,StmtResult, andBatchResultboth ways.LibsqlClientConfiggains anEncodingenum (JSON,PROTOBUF) as its last component. The existing constructors still default to JSON.LibsqlUrlParserreadsencoding=json|protobuf|proto. An unknown value throws, andencoding=protobufon anhttporhttpsURL throws because Protobuf over HTTP is out of scope.LibsqlWebSocketClientderives the subprotocol from the codec,hrana3for JSON andhrana3-protobuffor Protobuf, and rejects a server that negotiates a different one.LibsqlDriverselects the codec from the encoding.No new dependency.
protobuf-javaand the codegen were already present.Evidence
./mvnw -q -pl libsql-hrana-codec,libsql-client,libsql-jdbc -am testpasses../mvnw -q spotless:checkpasses.DOCKER_CONFIG="$PWD/libsql-conformance/src/test/docker-config" ./mvnw -pl libsql-itests -am -Dit.test='WebSocket*TransportIT' -DfailIfNoTests=false verifypasses 8 of 8, split asWebSocketTransportIT5 of 5 on JSON andWebSocketProtobufTransportIT3 of 3 on Protobuf.The Protobuf integration test covers typed select values including
Long.MIN_VALUEand a blob, transaction commit and rollback, and error mapping. The codec unit test coversLong.MIN_VALUE,Long.MAX_VALUE, doubles, unicode text, null, empty and non-empty blobs, named arguments, batch conditions, and both error messages.Limits
v3-protobuf/pipeline) is out of scope.wsshas no TLS integration test. The container runs plainws.