streamlit.server.server.Server
singletonパターン
(get_current でsingletonのServerオブジェクトを返す)
__init__
Create the server. It won't be started yet.
server.start()
_create_app()
Create our tornado web app
return tornado.web.Application
/stream - _BrowserWebSocketHandler
tornado.websocket.WebSocketHandlerを継承したクラス
/healthz - HealthHandler
streamlit.server.routesから
/debugz - DebugHandler
/metrics - MetricsHandler
start_listening(app)
Makes the server start listening at the configured port.
ソケット通信(待ち受ける状態)
ポート3000番はフロントエンドの開発サーバーで使う
self._ioloop.spawn_callback(self._loop_coroutine, on_started)
on_startedは起動時のcallable
self._loop_coroutine()
yieldしているのでジェネレータ
yield tornado.gen.sleep(0.01) する無限ループ
this is a non-blocking analogue to time.sleep (which should not be used in coroutines because it is blocking)
@tornado.gen.coroutine
Decorator for asynchronous generators.
ここで確認・変更しているServerのstateがweb socketに関係しているっぽい
server.add_preheated_report_session()
Register a fake browser with the server and run the script. (強調引用者)
script_pathのスクリプトに関係
self._create_or_reuse_report_session()
Register a connected browser with the server
ReportSessionを返す