Extension including both Tornado-app and frontend

I’m trying to create an extension which includes both a Tornado webserver-app (using RequestHandler) AND a frontend.

The structure from the examples are kept, both are registered in _init_.py in ext.Extension.setup.

But… I can’t figure out how to find the frontend instance to call it from the RequestHandlers… What’s the correct way for this?

Currently this isn’t supported. Frontends don’t know about each other, and the web apps are effectively frontends as they run inside the HTTP frontend.

I understand that frontends are not supposed to know about each other.

I’m creating an extension which is a party jukebox. Opposed to ordinary player apps a jukebox is more restrictive and I need some functionality and data common to all clients (which is a Tornado server app, a bunch of stateless request handlers).

Maybe a little limited in my knowledge I thought that a frondend was a good place for this common functionality as I also need some of the player events (CoreListener). I fixed this by letting the frontend expose it’s actor in a global variable and this works.

But I actually don’t need a frontend - it’s only internally serving the webserver app. So, next question: Will it be prettier to drop the frondend and let the Tornado app factory create a class based on ThreadingActor and CoreListener?

I hope this is the right forum for programming related discussions? I find Mopidy and it’s extension possibilities very exiting. Great work!

Yes, just having an extra actor in your web extension which all the web request handlers can talk with seems like a step in the right direction.

Can you share the code? How to put ThreadingActor in a factory?