Hi Kenton,
Sorry for the delay, but I believe this was an issue with how I was using
pycapnp. It turns out that pycapnp's binding is very sensitive to the
naming of arguments. In the example above,
class Notifier(schema.Notifier.Server):
def notify(self, params, **kwargs):
print "notifying"
notify's "params" argument was named "data" in the capnp schema file.
After changing the name, everything works fine! Not sure what can be done
about this in a language like Python unfortunately...
-Cody
On Thursday, February 15, 2018 at 3:25:35 PM UTC-8, Kenton Varda wrote:
>
> It looks like capnp.wait_forever() is actually implemented as
> kj::NEVER_DONE.wait() under the hood.
>
> Can you provide more complete example code that we would be able to build
> and run?
>
> -Kenton
>
> On Wed, Feb 14, 2018 at 2:45 PM, <[email protected] <javascript:>>
> wrote:
>
>> I have a use-case which is similar to streaming RPC to a server written
>> in C++ - here is a simplified example:
>>
>> # Setup a client and connect it to our task server
>> client = capnp.TwoPartyClient('localhost:8000')
>> task_mgr = client.bootstrap().cast_as(schema.Task)
>>
>> class Notifier(schema.Notifier.Server):
>> def notify(self, params, **kwargs):
>> print "notifying"
>>
>> task = task_mgr.create(type=0)
>> n = Notifier()
>> task.add_notifier(n).wait()
>>
>> task.run().wait()
>>
>> capnp.wait_forever()
>>
>> The C++ server will kick off the task which will call the notifier's
>> notify asynchronously. The C++ client works as expected (I get notify
>> callbacks when the task wants to notify). The python client seems to be
>> unable to pump the message loop. I see an example with a threaded client
>> which involves repeatedly chaining promises to make something like this
>> work, but is there an easier way?
>>
>> I was hoping that the capnp.wait_forever() would take care of pumping the
>> loop and executing any callbacks, similar to
>> my kj::NEVER_DONE.wait(client.getWaitScope()); in the C++ client...
>>
>>
>>
>>
>> --
>> 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] <javascript:>.
>> Visit this group at https://groups.google.com/group/capnproto.
>>
>
>
--
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].
Visit this group at https://groups.google.com/group/capnproto.