My question is:
Is it ok to share the established session between different (possibly) concurrent calls?. I mean, it is possible that MyClient.my_rpc_call1 and MyClient.my_rpc_call2 (and so on) will be called by different threads.
Usually, you do not need threads to do concurrent programming with an async framework like asyncio. The docs say you’d have to be using run_coroutine_threadsafe from a different thread. So, if you are using threads, can you expand your example to include those? Otherwise, don’t worry about threads (and yes, one session can run multiple calls “at once” without threads).
I think you don’t need to bother with run_coroutine_threadsafe at all, and just use e.g. asyncio.gather or so on the two futures/coroutines from f1 and f2. Something approximately like: loop.run_until_complete(asyncio.gather([f1(c), f2(c)])).
There seems to be some confusion in the above about the difference between the Component API (which can be used for a more “functional” approach to writing WAMP code) and the ApplicationSession object (which can be used for a “subclass” approach to writing WAMP code). The e.g. autobahn.asyncio.component.run method can be used to run code written using either approach and ApplicationRunner can be used to run only subclass-style code.
As for the lifecycles: the Component instances live longer than a single WAMP session (e.g. they do re-connections) whereas an ApplicationSession (or subclass) instance lives only exactly as long as a WAMP session does. A WAMP session lives at most as long as the underlying transport connection.