Remix.run Logo
deepsun 4 days ago

The main problem was always the same -- all the RPC libraries are designed to hide where the round-trip happens, but in real world you always want to know where and how the round-trip happens.

Just read about Cap'n Web array .map() [1] -- it's hard to understand where the round-trip is. And that is not a feature, that's a bug -- in reality you want to easily tell what the code does, not hide it.

[1] https://blog.cloudflare.com/capnweb-javascript-rpc-library/#...

kentonv 4 days ago | parent [-]

The round trip happens when you `await` the result.

You can tell that promise pipelining isn't adding any round trips because you set it all up in a series of statements without any `await`s. At the end you do one `await`. That's your round trip.

degamad 4 days ago | parent [-]

You say "round trip", but you mean "return trip", right?

Because if I understand correctly, you don't queue the requests and then perform a single request/response cycle (a "round trip"), you send a bunch of requests as they happen with no response expected, then when an await happens, you send a message saying "okay, that's all, please send me the result" and get a response.

kentonv 3 days ago | parent | next [-]

In HTTP batch mode, they're all sent as a batch.

In WebSocket mode, yes, you are sending messages with each call. But you're not waiting for anything before sending the next message. It's not a round trip until you await something. As far as round trips are concerned, there is really no difference between sending multiple messages vs. a single batch message, if you are ultimately only waiting for one reply at the end.

crabmusket 4 days ago | parent | prev [-]

No, the requests are queued and sent as a batch.

degamad 4 days ago | parent [-]

Ah, okay, that's much better then... In principle, that then allows the server to aggregate or optimise the operations rather than performing them as written. While that might not be relevant for version 1, it's useful to have for later.

kentonv 3 days ago | parent [-]

What does server-side aggregation for optimization have to do with round trips, though?