XS is intentionally a stateless programming model. You should design your applications so that they persist data either on the client side or in the database itself.
Personally I created a single database table to hold such session and application variables. I then created some stored procedures and an xsjs library to make it reusable to write and read from this central "server cookie" table (very similar to BSP server cookies in ABAP). It also contains a function to serialize/parse record sets to/from JSON for easy storage in this session table. This is just demo/personal code - not production quality; but perhaps it offers some ideas. https://dl.dropboxusercontent.com/u/643382/HANA_XS_UTIL-sap.com.tgz