From 72dfdc6c8aff7f4f61c409e771df6a19299ad36f Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Tue, 4 Apr 2023 18:29:51 +0100 Subject: [PATCH] Corrected user session documentation example (Fixes #1170) --- docs/server.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/server.rst b/docs/server.rst index d0dfd3c..5a6798c 100644 --- a/docs/server.rst +++ b/docs/server.rst @@ -448,13 +448,13 @@ The session can also be manipulated with the `session()` context manager:: For the ``asyncio`` server, an asynchronous context manager is used:: @sio.event - def connect(sid, environ): + async def connect(sid, environ): username = authenticate_user(environ) async with sio.session(sid) as session: session['username'] = username @sio.event - def message(sid, data): + async def message(sid, data): async with sio.session(sid) as session: print('message from ', session['username'])