Browse Source

Corrected user session documentation example (Fixes #1170)

pull/1175/head
Miguel Grinberg 2 years ago
committed by GitHub
parent
commit
72dfdc6c8a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docs/server.rst

4
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'])

Loading…
Cancel
Save