Skip to content

Get Server object from Client on the server side #370

@peter-dobsa

Description

@peter-dobsa

I'm unsure how can I "unwrap" the underlying server object when it's returned from the client as part of an API call. This is something that is easily achievable on the C++ side via CapabilityServerSet, but I can't seem to find an alternative in the python wrapper.

Example:

interface MyInterface {
  interface MyObject {}
  create @0 () -> (obj :MyObject);
  doSomething @1 (obj :MyObject) -> ();
}
class MyObjectImpl(myinterface_capnp.MyInterface.MyObject.Server):
    # server-side implementetion of MyObject

class MyInterfaceImpl(myinterface_capnp.MyInterface.Server):
    async def create(self, **kwargs):
        return MyObjectIml()

    async def doSomething(self, obj, **kwargs):
        # obj is of type capnp.lib.capnp._DynamicCapabilityClient
        # I'd like to access the corresponding MyObjectImpl object

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions