Don't worry about it!

-Kenton

On Fri, Jul 8, 2016 at 2:52 AM, <[email protected]> wrote:

> Hello Kenton,
>
> sorry for the redundant post and for wasting your time. I tried to delete
> this post but obviously was unable to.
>
> Thanks a lot for your answer :)
>
> Best regards,
> Jupp
>
> On Friday, July 8, 2016 at 6:59:52 AM UTC+2, Kenton Varda wrote:
>>
>> Hmm it looks like there are two version of this thread and David gave
>> exactly the same answer in the other version. :)
>>
>> -Kenton
>>
>> On Thu, Jul 7, 2016 at 9:26 PM, Kenton Varda <[email protected]> wrote:
>>
>>> Hi Jupp,
>>>
>>> On Sun, Jul 3, 2016 at 12:12 PM, <[email protected]> wrote:
>>>
>>>> Is this the right way to implement such a use case?
>>>>
>>>
>>> Yes. :)
>>>
>>>
>>>> How is it possible to detect if a client has disconnected and how could
>>>> this be mapped to a previously stored capability?
>>>>
>>>
>>> I like to do this:
>>>
>>>     interface Handle {
>>>       // no methods
>>>     }
>>>
>>>     registerClientInterface @0 (client :ClientInterface) -> (handle
>>> :Handle);
>>>
>>> The idea is that when the client registers its callback, the server
>>> returns a `handle` object representing the registration. The client holds
>>> on to this object as long as it wants to remain registered. If the client
>>> drops the object, then the handle's destructor will be called on the
>>> server, and the server can then unregister the callback for that client.
>>> Better yet, if the client disconnects, this will also cause the handle's
>>> destructor to be called. So, using this, you can both detect disconnects
>>> and give the client a voluntary way to unregister itself all at once.
>>>
>>> BTW, also note that if you call a method on a disconnected capability,
>>> it will throw a special kind of exception. exception.getType() will return
>>> kj::Exception::Type::DISCONNECTED.
>>>
>>> -Kenton
>>>
>>
>> --
> 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.
>

-- 
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.

Reply via email to