You can use case 2 and do something like:

  session - "id" + ("id" -> "newID")

You can then call your controller via Ajax for instance, the change to your session will then be taken into account, you can then apply the changes to UI (if any) once you get the Ok status back from your controller. If there are no apparent changes, then you can stop there, all the following interactions with the app will be using this new session.

Related Query

More Query from same tag