How to start multiple ApplicationSession components?

#1

Is there a way to start multiple wamp components that inherit ApplicationSession ? All examples that I have seen only start a single component, for example https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/wamp/overview/frontend.py#L27

I do know that can be done using Component API but wanted to be sure if it was possible with ApplicationSession or not.

0 Likes

#2

Yes. You can use ApplicationSession with Component so you can then run multiple components which use subclassing. Simply assign Component.session_factory or pass the session_factory= kwarg to Component with your ApplicationSession subclass.

1 Like

#3

That’s a new thing I learned and will definitely be helpful. Though for my original question I was not using Component and found out that if I delay starting of the reactor, I can start multiple ApplicationSession subclass components like I did here https://github.com/deskconn/deskconn-server/blob/58a73eb438d5c039d69a77ae6859f1eb26ac40b3/session.py#L27

0 Likes

#4

Okay, that should work as well.

“In general” new code would be best to use Component – especially so we can discover any remaining gaps.

1 Like