Cross-session Context

In this Lesson

In this lesson you will learn how context can be shared across sessions.

Concepts

Agents running within the same session share the same context. For example, when the PartyList agent publishes a party id any agents in the same session that subscribe to party id will be notified of the new context value. Agents in other sessions are not notified (this is the default behavior).

Cross-session Context Listening

Agents may ask to be notified of context changes in other sessions. This enables the agent to be notified of context changes in multiple sessions: their own session + any sessions they are listening to.

An agent’s Context section is used to subscribe to context changes in other sessions



Agents can listen to multiple sessions



Which is shown here

Session Independence

Sessions run independently from each other. For example, imagine a user presses a button in a West session – the server will re-activate only the west session and send the event triggered by the button to the appropriate agent. Any other sessions that may exist in the home do not run (this is the default behavior).

Cross-session context listeners can cause multiple sessions to be run in response to user interaction. For example, imagine a user presses a button in a West session which cause a value to be placed into context. If agents in other sessions are listening for the modified context value then the listening session will also be re-activated and the modified context from the west session will be pushed into the listening session and all agents in the listening session that subscribe to the value will be notified of the change.

One listener is enough
As long as one agent is listening for a context value change then context values will be pushed into the listening agent’s session – and ALL agents in the listening session that subscribe to the context value name will be given the new context value.

That’s all for this lesson.