Friday, January 12, 2024

Re: Is moving away from RPC a good idea?

If you do not have special needs I think GWT-RPC is still fine especially with a jakarta version now available. But while it is easy to use it also has some annoying downsides you have to live with.

However there are quite some options:
- JsInterop based DTOs + JSON.parse/stringify. However you loose inheritance or have to write some helper code to workaround it as needed
- Use a json based library that solves the polymorphism problem for you
- Use gRPC for the web (grpc-web) which requires a proxy in front of your server gRPC endpoint to transparently convert binary to json
- Use websocket in either plain text mode or binary mode. If in binary mode you could use protobuf or similar to build the payload

Personally I always wanted to explore using nats.io, which is a message broker that also supports a request-reply pattern out of the box. That means a message channel/topic acts like a service. Nats has a nats-websocket library which connects browsers to the message broker and you can use protobuf or similar to define/generate your binary messages. Because you now have a message broker between clients and servers it should be relatively easy to scale and you get things like broadcast a message to all clients (push) with little effort. Nats also has a distributed KV store integrated if needed.

-- J.

Christian Hebert schrieb am Mittwoch, 10. Januar 2024 um 17:26:04 UTC+1:
Hi guys, I've seen the changes in the new release regarding jakarta servlets, which is great, it's a step toward jakarta but to this day,  GWT is still based on the Servlet API 3.1.

Prior of seeing that change, I tried to move away from RPC calls and use http requests instead. I found a nice library called RestyGWT (https://resty-gwt.github.io/) who can really simplify the process of handling json data from/to a Rest API.

So I converted my GWT remote servlets to a Rest API, made a few minor changes in my client code and voilà, I was able to deploy it on a Jakarta Application server since there is no GWT involved on the server side anymore.

The last version of RestyGWT has been release in 2020 so I'm not sure how active this project is but from what I've seen it's enough for me.

So, I would like to get your thoughts on that.  Would you go on that road? stick to RPC calls and wait for a version of GWT based on Jakarta? build your "own" GWT with the changes introduced in the vew version?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/5aaec5f2-3d64-45fc-a3d6-63b0d310684fn%40googlegroups.com.

No comments:

Post a Comment