-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protobufjs Codec and general EncConn support #130
Comments
@delaneyj for the deno based clients, the correct thing is to create a new wrapper client. Currently exploring this for JetStream, and want to offer a similar pattern. This will allow all clients that use the same platform to have same functionality. |
The main thing to think about is that adding 3rd party dependencies for out of the box encodings is problematic. Think about in other JavaScript runtimes, even TextEncoder is not available. But having a general facility where the subscription callback or iterator receive messages in a decoded format, definitely has merit. So internally there's a class that can do encoded subscriptions. This has not been surfaced up because I believe it is possibly the wrong approach, and want to take another crack at it before 3.0 is out. In the mean while if you want to play on the edge: https://github.com/nats-io/nats.deno/blob/main/nats-base-client/typedsub.ts#L82 |
thanks @aricart makes sense. wil give it a crack !! |
Not ready for a PR but more of a discussion. Wanted to match the protobuf support and EncodedConn similar to the Go API using the pbjs/pbts tooling from protobufjs.
So I mocked out an
encoder.ts
and tested with
So you get full static typing and small sizes on the wire. Still have access to json by doing
.toObject()
. Just looking to see if this sparks any ideas from anyone else.The text was updated successfully, but these errors were encountered: