Re: [capnproto] Unsubscribe in pub/sub model

2022-02-08 Thread Dane
Hi All, Implementing a similar thing, but with an asynchronous client in python. I can't for the life of me get the client object to become derefenced. The asyncio tx/rx seems to get stuck trying to read/write to the now-missing publisher. I think the async loop owns a reference to the

Re: [capnproto] Unsubscribe in pub/sub model

2021-12-03 Thread 'Kenton Varda' via Cap'n Proto
What I usually do is something like: auto impl = kj::heap(); auto& ref = *impl; Subscriber::Client client = kj::mv(impl); rq.setSubscriber(client); Now you can keep a copy of `client` locally, and as long as it still exists, then `ref` remains valid -- because `client` is itself a strong

Re: [capnproto] Unsubscribe in pub/sub model

2021-12-02 Thread Jens Alfke
I'm also implementing pub-sub, so I was glad to see this thread before I wasted too much time. I'm implementing this pattern, but having trouble on the client side. In terms of the example interface, I've created my SubscriberImpl class, and written the code to send the "subscribe" message.

Re: [capnproto] Unsubscribe in pub/sub model

2021-11-23 Thread mitsuo
Hi Kenton, Thank you for your quick response! It's very helpful because the handler for the disconnection is another issue actually. On Tuesday, November 23, 2021 at 1:53:42 AM UTC+9 ken...@cloudflare.com wrote: > Hi Mitsuo, > > I recommend designing the interface like this: > > interface

Re: [capnproto] Unsubscribe in pub/sub model

2021-11-22 Thread 'Kenton Varda' via Cap'n Proto
Hi Mitsuo, I recommend designing the interface like this: interface EventPublisher{ interface Subscriber { updateEvent @0 (event: Int32) -> (); } interface Subscription {} subscribe @0 (subscriber: Subscriber) -> (result: Int32, subscription: Subscription); # To

[capnproto] Unsubscribe in pub/sub model

2021-11-21 Thread mitsuo
Hi, I'm trying to implement pub/sub like communication model with the following scheme. *pubsub.capnp* *interface EventPublisher{* *interface Subscriber {* *updateEvent @0 (event: Int32) -> ();* *}* *subscribe @0 (subscriber: Subscriber) -> (result: Int32);* *unsubscribe