Skip to content

Understanding AtmosphereResourceSession

Lance edited this page Jan 16, 2014 · 3 revisions

You can use an AtmosphereResourceSession to store serverside attributes against an AtmosphereResource. The AtmosphereResourceSession lives from the time it is created until the client disconnects. AtmosphereResourceSession instances are managed by the AtmosphereResourceSessionFactory.

eg:

public void setSessionValue(AtmosphereResource resource, String attributeName, Object attributeValue) {
   AtmosphereResourceSessionFactory factory = AtmosphereResourceSessionFactory.getDefault();
   AtmosphereResourceSession session = factory.getSession(resource);
   session.setAttribute(attributeName, attributeValue);
}

public Object getSessionValue(AtmosphereResource resource, String attributeName) {
   AtmosphereResourceSessionFactory factory = AtmosphereResourceSessionFactory.getDefault();
   AtmosphereResourceSession session = factory.getSession(resource, false);
   return session == null ? null : session.getAttribute(attributeName);
}

Step by Step Tutorials

Concepts & Architecture

15 Minutes Tutorial

Advanced Topics

API

Known WebServer Issues

References

External Documentations

githalytics.com alpha

Clone this wiki locally