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

Server-side native object support #2

Closed
wemoloh opened this issue Mar 22, 2018 · 0 comments
Closed

Server-side native object support #2

wemoloh opened this issue Mar 22, 2018 · 0 comments
Assignees

Comments

@wemoloh
Copy link
Contributor

wemoloh commented Mar 22, 2018

Passing a native object from the client to the server as a method argument works as documented, but server-created native objects can't be passed back:

import eider

class MyRoot(eider.LocalRoot):
    def foo(self):
        return MyClass()

class MyClass:
    def bar(self):
        return 'baz'

eider.serve(12345, root=MyRoot)
>>> from eider import BlockingConnection
>>> conn = BlockingConnection('ws://localhost:12345/')
>>> sess = conn.create_session()
>>> b = sess.root().foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "eider.py", line 1267, in __call__
    return self.robj._rsession.conn.loop.run_until_complete(super().__call__(*params))
  File "/usr/local/lib/python3.4/asyncio/base_events.py", line 373, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.4/asyncio/futures.py", line 274, in result
    raise self._exception
  File "eider.py", line 1006, in dispatch
    result = self.getresult(rcodec, rcall.rsession, msg)
  File "eider.py", line 1066, in getresult
    return rsession.unmarshal_all(rcodec, msg['result'])
  File "eider.py", line 222, in unmarshal_all
    return self.unmarshal_all_inband(obj, srcid)
  File "eider.py", line 228, in unmarshal_all_inband
    return self.unmarshal(obj, srcid)
  File "eider.py", line 244, in unmarshal
    obj = self.unmarshal_obj(ref, srcid)
  File "eider.py", line 685, in unmarshal_obj
    raise LookupError('Unknown session: {}'.format(rsid))
LookupError: Unknown session: -1
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