If the thread running sessions are not the same as the thread running the asyncio event loop, you need to wrap ``run_asyncio_coroutine()`` to run the coroutine in asyncio. Can only be used in :ref:`coroutine-based session `. :param coro_obj: Coroutine obje
(coro_obj)
| 423 | |
| 424 | @check_session_impl(CoroutineBasedSession) |
| 425 | async def run_asyncio_coroutine(coro_obj): |
| 426 | """ |
| 427 | If the thread running sessions are not the same as the thread running the asyncio event loop, |
| 428 | you need to wrap ``run_asyncio_coroutine()`` to run the coroutine in asyncio. |
| 429 | |
| 430 | Can only be used in :ref:`coroutine-based session <coroutine_based_session>`. |
| 431 | |
| 432 | :param coro_obj: Coroutine object in `asyncio` |
| 433 | |
| 434 | Example:: |
| 435 | |
| 436 | async def app(): |
| 437 | put_text('hello') |
| 438 | await run_asyncio_coroutine(asyncio.sleep(1)) |
| 439 | put_text('world') |
| 440 | |
| 441 | pywebio.platform.flask.start_server(app) |
| 442 | |
| 443 | """ |
| 444 | return await get_current_session().run_asyncio_coroutine(coro_obj) |
| 445 | |
| 446 | |
| 447 | @check_session_impl(ThreadBasedSession) |
no test coverage detected
searching dependent graphs…