diff --git a/shiny/session/_session.py b/shiny/session/_session.py index 82c25f4b7..b37484f1c 100644 --- a/shiny/session/_session.py +++ b/shiny/session/_session.py @@ -205,8 +205,8 @@ async def close(self, code: int = 1001) -> None: self._run_session_end_tasks() async def _run(self) -> None: - await self.send_custom_message( - "config", {"workerId": "", "sessionId": str(self.id), "user": None} + await self._send_message( + {"config": {"workerId": "", "sessionId": str(self.id), "user": None}} ) try: @@ -295,9 +295,7 @@ async def _dispatch(self, message: ClientMessageOther) -> None: await self._send_response(message, value) async def _send_response(self, message: ClientMessageOther, value: object) -> None: - await self.send_custom_message( - "response", {"tag": message["tag"], "value": value} - ) + await self._send_message({"response": {"tag": message["tag"], "value": value}}) # This is called during __init__. def _create_message_handlers(self) -> Dict[str, Callable[..., Awaitable[object]]]: @@ -777,8 +775,8 @@ def set_fn(fn: render.RenderFunction) -> None: priority=priority, ) async def output_obs(): - await self._session.send_custom_message( - "recalculating", {"name": fn_name, "status": "recalculating"} + await self._session._send_message( + {"recalculating": {"name": fn_name, "status": "recalculating"}} ) message: Dict[str, object] = {} @@ -815,8 +813,8 @@ async def output_obs(): self._session._outbound_message_queues["values"].append(message) - await self._session.send_custom_message( - "recalculating", {"name": fn_name, "status": "recalculated"} + await self._session._send_message( + {"recalculating": {"name": fn_name, "status": "recalculated"}} ) self._effects[fn_name] = output_obs