Search code examples
sessionplayframeworkatmosphere

How to enable Play session support in atmosphere play plugin?


I am familiar with nodeJS and socket.io and I'm trying to use something similar in Java with atmosphere. I included the atmosphere-play plugin and everything seems to work. The problem I have is with enabling session support. In the Github atmosphere wiki it says how to enable it in the web.xml/application.xml, however it's not documented how to enable it in play and since I've never seen a web.xml in play (I'm pretty new to it) I'd like to know if somebody can help.

I'd feel that something like this should be done in application.conf but this seems not to be the case.


Solution

  • One way to do this: In Global.java right before you initialise the Atmosphere listeners you code do the following:

    @Override
    public void onStart(Application application) {
        instance().framework().getAtmosphereConfig().setSupportSession(true);
        instance().discover(Chat.class).ready();
    }
    

    then the log shows this:

    [info] o.a.c.AtmosphereFramework - HttpSession supported: true