Git Product home page Git Product logo

Comments (9)

gkdn avatar gkdn commented on May 19, 2024 2

WIP but https://github.com/google/j2cl-proto

from j2cl.

gkdn avatar gkdn commented on May 19, 2024

Default Java protobuf implementation would not work with J2CL as it relies on reflection.

We have a particular implementation of J2CL that generates the same API but makes it JavaScript friendly. We are looking into open-sourcing it but cannot give you a definite time line.

from j2cl.

sgammon avatar sgammon commented on May 19, 2024

@gkdn thank you for your response on this. is there any update? it is becoming a blocker for us

from j2cl.

sgammon avatar sgammon commented on May 19, 2024

@gkdn thank you for sharing, this looks awesome.

from j2cl.

gkdn avatar gkdn commented on May 19, 2024

j2cl-proto should be working fine for a while now. That would be great if somebody could put some samples there but for the purposes of this bug, I think we are don.

from j2cl.

gkdn avatar gkdn commented on May 19, 2024

There was a mistake on the release. Re-opening this.

from j2cl.

sgammon avatar sgammon commented on May 19, 2024

@gkdn i have a few questions, when you have some time to answer them (i know this is still under development).

  1. we're already using protobuf JS and grpc-web in our frontend dependency mix - how might we pass objects between J2CL and other Closure-enabled code in JS?

  2. what about gRPC on the J2CL side? assuming the answer to q#1 is complex, and we choose to keep all of our code in J2CL land (avoiding the need to bridge back and forth for immutable JS proto records), how would we dispatch to gRPC and back to produce those objects in J2CL?

from j2cl.

sgammon avatar sgammon commented on May 19, 2024

in any case, i'm excited to use this more, and i've integrated J2CL into Elide (the framework) and our own internal apps. but that's what's holding me up from using it in full, because our object model heavily uses protobuf, and so without those objects, J2CL is relegated to sharing constants between the frontend and backend, when it can do so much more.

from j2cl.

gkdn avatar gkdn commented on May 19, 2024

we're already using protobuf JS and grpc-web in our frontend dependency mix - how might we pass objects between J2CL and other Closure-enabled code in JS?

This is why we introduced immutable js proto under the J2CL proto repository. It provides seamless integration with closure. And they were "suppose" to be easy to convert to mutable protobuf JS.
I'm saying "suppose to" because we currently don't support binary wire format. We support something called JSPB which is the google's internal format. Without binary you cannot replace your existing protobuf JS usages in open-source nor easily convert them. So you would need to do copy manually or via code generation.

On the bright side, the discussions of supporting binary format in immutable protobuf as well as converging to a single js protobuf implementation is still ongoing.

what about gRPC on the J2CL side?

I don't have gRPC experience but I assume it would be using the standard proto serialization (i.e. binary format). If you would like to avoid bridging via immmutable js proto then you would need to maintain your own @JsType(isNative=true) Java model objects that maps to Closure types.
You can also experiment with auto generating them via protoc plugin (similar to J2CL protos).

from j2cl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.