Func
2 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
3 deletions
-
src/socketio/async_server.py
|
@ -373,15 +373,15 @@ class AsyncServer(base_server.BaseServer): |
|
|
context manager block are saved back to the session. Example usage:: |
|
|
context manager block are saved back to the session. Example usage:: |
|
|
|
|
|
|
|
|
@eio.on('connect') |
|
|
@eio.on('connect') |
|
|
def on_connect(sid, environ): |
|
|
async def on_connect(sid, environ): |
|
|
username = authenticate_user(environ) |
|
|
username = authenticate_user(environ) |
|
|
if not username: |
|
|
if not username: |
|
|
return False |
|
|
return False |
|
|
with eio.session(sid) as session: |
|
|
async with eio.session(sid) as session: |
|
|
session['username'] = username |
|
|
session['username'] = username |
|
|
|
|
|
|
|
|
@eio.on('message') |
|
|
@eio.on('message') |
|
|
def on_message(sid, msg): |
|
|
async def on_message(sid, msg): |
|
|
async with eio.session(sid) as session: |
|
|
async with eio.session(sid) as session: |
|
|
print('received message from ', session['username']) |
|
|
print('received message from ', session['username']) |
|
|
""" |
|
|
""" |
|
|