Skip to content
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

custom codec examples dont work when using on client not build with rust #2017

Open
codeitlikemiley opened this issue Oct 19, 2024 · 0 comments

Comments

@codeitlikemiley
Copy link

codeitlikemiley commented Oct 19, 2024

I have re-created the examples for json-codec

https://github.com/codeitlikemiley/json-codec

from:

https://github.com/hyperium/tonic/blob/master/examples/src/json-codec/server.rs
https://github.com/hyperium/tonic/blob/master/examples/src/json-codec/common.rs
https://github.com/hyperium/tonic/blob/master/examples/src/json-codec/client.rs

I am experimenting on it , if i can reduced as much as code

i wonder if i can use this concept of custom codec with duplex connection

with axum and tonic:
https://github.com/codeitlikemiley/duplex-server-rs/blob/61c088d0c5554272a2eb5a79915abeed4d201797/src/main.rs#L35

that example is already working , but

what i had in mind is if we just run tonic alone , and pass

on headers application/json for content type

would be able to use client like grpcurl , curl, postman?

That when i found out that we cant

on the premise that we are being required to have tonic-reflection

in our case we are using tonic::manual

as such there is not config to specify a proto

and defining or re-creating a proto file in our case hello-world.proto

would have codec discrepancy as it would use the default ProstCodec and not the JsonCodec

So im a kinda stuck on a loop , and would like to know if anyone have success on using this on real world project

as the example alone is only useful if the client was built with rust, what if our client is on js
or using curl, grpcup or postman etc.

I couldnt wrap it around my head on how to make best use of custom codec

as its impossible to use on different client as those clients dont expect json

or am i missing something out ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant