On Mon, Oct 28, 2019 at 6:50 PM 林晓锋 <[email protected]> wrote:
> Hi, > Thanks for your response! > For me, I want to keep the `function` which was sent by the client, so > that the server can call it whenever it wants. But it seems that the > `function` is called immediately by sever when it is received. > You can keep a `Client` as long as you want. The calculator example server sends an RPC to the `Function::Client` immediately, but there's nothing stopping a server from hanging onto this value long-term. And I don't know how I can get the `function`'s name and params list, > which may be useful when the server wants to call the `function` with its > own params. > Hmm, I think maybe the specific example here might be causing some confusing. The type `Function` is an interface defined in calculator.capnp -- it is specific to this example case. You can send any interface type over RPC, not just `Function`. You can of course include with it any metadata you want, by encoding the metadata in the Cap'n Proto message. -Kenton > > 在 2019年10月29日星期二 UTC+8上午1:13:08,Kenton Varda写道: >> >> Hi, >> >> Sorry, I don't really understand the question. The client calls >> `evaluate()` and passes a `Expression` of type `call` containing a >> `Function` capability. The server receives this expression, calls >> `getCall().getFunction()` to receive a `Function::Client`, which it can >> then use to invoke `Function.call()`. >> >> -Kenton >> >> On Mon, Oct 28, 2019 at 5:41 AM 林晓锋 <[email protected]> wrote: >> >>> Hi ,all: >>> It's memtioned that "Make a request that will call back to a >>> function defined locally." at calculator-client.c++.I'm confused how and >>> where the server holds the function and when to call it. (I guess that it's >>> in the EventLoop::turn() by reading code ,but i'm not sure how it works) >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Cap'n Proto" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/capnproto/fc157425-7acb-43a7-845f-7a978e27526f%40googlegroups.com >>> <https://groups.google.com/d/msgid/capnproto/fc157425-7acb-43a7-845f-7a978e27526f%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "Cap'n Proto" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/capnproto/d1c2f940-e418-4783-8ee4-e30d0535e12d%40googlegroups.com > <https://groups.google.com/d/msgid/capnproto/d1c2f940-e418-4783-8ee4-e30d0535e12d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/CAJouXQmWi1R55ptfMh8eFurLtdOzog%3DL%2BrbRsBHpFbbziFhmyg%40mail.gmail.com.
