bokeh.server.session#
Provides the ServerSession
class.
- class ServerSession(session_id: ID, document: Document, io_loop: IOLoop | None = None, token: str | None = None)[source]#
Hosts an application “instance” (an instantiated Document) for one or more connections.
Public Data Attributes:
document
id
A JWT token to authenticate the session.
destroyed
expiration_requested
expiration_blocked
expiration_blocked_count
connection_count
milliseconds_since_last_unsubscribe
Public Methods:
__init__
(session_id, document[, io_loop, token])destroy
()Used in test suite for now.
block_expiration
()unblock_expiration
()subscribe
(connection)This should only be called by
ServerConnection.subscribe_session
or our book-keeping will be brokenunsubscribe
(connection)This should only be called by
ServerConnection.unsubscribe_session
or our book-keeping will be brokenwith_document_locked
(func, *args, **kwargs)Asynchronously locks the document and runs the function with it locked.
pull
(message, connection)Handle a PULL-DOC, return a Future with work to be scheduled.
push
(message, connection)Handle a PUSH-DOC, return a Future with work to be scheduled.
patch
(message, connection)Handle a PATCH-DOC, return a Future with work to be scheduled.
Notify the document that the connection was lost.
- classmethod patch(message: msg.patch_doc, connection: ServerConnection) msg.ok [source]#
Handle a PATCH-DOC, return a Future with work to be scheduled.
- classmethod pull(message: msg.pull_doc_req, connection: ServerConnection) msg.pull_doc_reply [source]#
Handle a PULL-DOC, return a Future with work to be scheduled.
- classmethod push(message: msg.push_doc, connection: ServerConnection) msg.ok [source]#
Handle a PUSH-DOC, return a Future with work to be scheduled.
- request_expiration() None [source]#
Used in test suite for now. Forces immediate expiration if no connections.
- subscribe(connection: ServerConnection) None [source]#
This should only be called by
ServerConnection.subscribe_session
or our book-keeping will be broken
- unsubscribe(connection: ServerConnection) None [source]#
This should only be called by
ServerConnection.unsubscribe_session
or our book-keeping will be broken