Async tail call #48
molvqingtai
started this conversation in
Ideas
Replies: 1 comment
-
|
什么时候开整??期待👀 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is an experimental idea, if asynchronous tail calls are supported, then getter/setter and chained call batching can be supported.
Current Version:
call method immediately sends a remote request
Tail Call Version:
Only when accessing promise.then() does the remote request get initiated.
In the tail call version, RpcPromise is directly returned in all call chains, which is a wrapped promise. The actual RPC call is only sent when accessing then, so we can collect the call path and implement batch processing before calling then, and we can directly use getters and setters without depending on asynchronous methods.
Challenges to be addressed::
No matter what the server defines, it is always inferred as an asynchronous method on the client, and the parameters can receive arg | RpcPromise | Promise
If you need to support callback on the server side, you must use a long connection, such as websocket.
Unserializable values should be prohibited from calling then
Reference:
https://github.com/cloudflare/capnweb#http-batch-client
Beta Was this translation helpful? Give feedback.
All reactions