Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Server object from Client on the server side #370

Open
peter-dobsa opened this issue Oct 14, 2024 · 0 comments
Open

Get Server object from Client on the server side #370

peter-dobsa opened this issue Oct 14, 2024 · 0 comments

Comments

@peter-dobsa
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant