class_docstr: Represents a websocket connection to a server-side session.
  
  Each server session stores a Document, which is kept in sync with the
  corresponding Document for this ``ClientSession`` instance. Updates on
  either side of the connection will automatically propagate to the other
  side, as long as the connection is open.
  
  ClientSession objects can (and usually should) be used as a context manager
  so that the session is properly closed:
  
  .. code-block:: python
  
      with pull_session(url=app_url) as mysession:
          # customize session here
          script = server_session(session_id=mysession.id, url=app_url)
          return render_template("embed.html", script=script, template="Flask")
  
  If you do not use ``ClientSession`` in this way, it is up to you to ensure
  that ``mysession.close()`` is called.
docstr: Push the given document to the server and record it as ``session.document``.
  
  If this is called more than once, the Document has to be the same (or None
  to mean ``session.document``).
  
  .. note::
      Automatically calls :func:`~connect` before pushing.
  
  Args:
      document (|Document|, optional) :
          The document that will be kept in sync with the server document.
          None to use ``session.document`` or create a new document.
docstr_tok: ["Push","the","given","document","to","the","server","and","record","it","as","``","session.document","``",".","If","this","is","called","more","than","once",",","the","Document","has","to","be","the","same","(","or","None","to","mean","``","session.document","``",")",".","..","note",":",":","Automatically","calls",":","func",":","`","~connect","`","before","pushing",".","Args",":","document","(","|Document|",",","optional",")",":","The","document","that","will","be","kept","in","sync","with","the","server","document",".","None","to","use","``","session.document","``","or","create","a","new","document","."]
code: def push(self, document: Document | None = None) -> None:
      """Push the given document to the server and record it as ``session.document``.
  
      If this is called more than once, the Document has to be the same (or None
      to mean ``session.document``).
  
      .. note::
          Automatically calls :func:`~connect` before pushing.
  
      Args:
          document (|Document|, optional) :
              The document that will be kept in sync with the server document.
              None to use ``session.document`` or create a new document.
  
      """
      if self.document is None:
          if document is None:
              doc = Document()
          else:
              doc = document
      else:
          if document is None:
              doc = self.document
          else:
              raise ValueError(
                  "Cannot push() a different document from existing session.document"
              )
  
      self.connect()
      self.check_connection_errors()
      self._connection.push_doc(doc)
      if self._document is None:
          self._attach_document(doc)
  
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING, Any, Literal
  from urllib.parse import quote_plus
  from ..core.types import ID
  from ..document import Document
  from ..resources import DEFAULT_SERVER_HTTP_URL, SessionCoordinates
  from ..util.browser import NEW_PARAM, BrowserLike, BrowserTarget
  from ..util.token import generate_jwt_token, generate_session_id
  from .states import ErrorReason
  from .util import server_url_for_websocket_url, websocket_url_for_server_url
label_desc: Use image node_id 17 for calling the ClientSession obj's underlying member method code with example usage: obj.push(document) without return types