reven2.session.Sessions(object)
class documentationreven2.session
(View In Hierarchy)
A list of the sessions that a REVEN server tracks.
The links generated e.g. by displaying a Transition in a Jupyter Notebook will send events to all the clients listening to the currently tracked sessions.
This object is not meant to be constructed directly. Use RevenServer.sessions
instead.
Method | __init__ | Undocumented |
Method | publish_transition | Send the passed transition to all clients that are listening to the currently tracked sessions. |
Method | tracked 0 | Property: The list of the currently tracked sessions. |
Method | tracked | Undocumented |
Method | available | A generator of the sessions known to the server. |
Method | active | A generator of the sessions to which at least one client is currently connected. |
Method | __repr__ | Undocumented |
Method | _publish | Undocumented |
Method | _js_publish_transition | Undocumented |
Send the passed transition to all clients that are listening to the currently tracked sessions.
The actual response of the clients to this event is client-specific. In Axion, the published transition will be selected.
>>> # Publish transition #100 to clients >>> reven_server.sessions.publish_transition(reven_server.trace.transition(100)) True
Parameters | transition | The reven2.trace.Transition
to send. |
Returns | True if there were some clients listening, False
otherwise. |
Property: The list of the currently tracked sessions.
>>> # Access the list of currently tracked sessions >>> reven_server.sessions.tracked [Session('default', 1)]
>>> # Only track session 'axion' going forward >>> reven_server.sessions.tracked = 'axion' >>> reven_server.sessions.tracked [Session('axion', 0)]
>>> # Add back the default session >>> reven_server.sessions.tracked.append("default") >>> reven_server.sessions.tracked [Session('axion', 0), Session('default', 1)]
>>> # Follow all available sessions >>> reven_server.sessions.tracked = reven_server.sessions.available() >>> reven_server.sessions.tracked [Session('test', 4), Session('default', 1), Session('axion', 0)]
A generator of the sessions to which at least one client is currently connected.
Returns | a generator of Session objects |