Skip to content

Commit 5e04003

Browse files
authored
Add missing async on session examples for the async server (#1465)
1 parent 86a7176 commit 5e04003

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/socketio/async_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,15 @@ def session(self, sid, namespace=None):
373373
context manager block are saved back to the session. Example usage::
374374
375375
@eio.on('connect')
376-
def on_connect(sid, environ):
376+
async def on_connect(sid, environ):
377377
username = authenticate_user(environ)
378378
if not username:
379379
return False
380-
with eio.session(sid) as session:
380+
async with eio.session(sid) as session:
381381
session['username'] = username
382382
383383
@eio.on('message')
384-
def on_message(sid, msg):
384+
async def on_message(sid, msg):
385385
async with eio.session(sid) as session:
386386
print('received message from ', session['username'])
387387
"""

0 commit comments

Comments
 (0)