I'm trying to run the example script:
from aiohttp import web
import socketio
sio = socketio.AsyncServer()
app = web.Application()
sio.attach(app)
async def index(request):
"""Serve the client-side application."""
with open('index.html') as f:
return web.Response(text=f.read(), content_type='text/html')
@sio.on('connect', namespace='/chat')
def connect(sid, environ):
print("connect ", sid)
@sio.on('chat message', namespace='/chat')
async def message(sid, data):
print("message ", data)
await sio.emit('reply', room=sid)
@sio.on('disconnect', namespace='/chat')
def disconnect(sid):
print('disconnect ', sid)
app.router.add_static('/static', 'static')
app.router.add_get('/', index)
if __name__ == '__main__':
web.run_app(app)
Which gives me the error:
Traceback (most recent call last):
File "websockServer.py", line 4, in <module>
sio = socketio.AsyncServer()
AttributeError: module 'socketio' has no attribute 'AsyncServer'
Oops. Just saw the reply here: https://github.com/miguelgrinberg/python-socketio/issues/190#issuecomment-405113349
Most helpful comment
Oops. Just saw the reply here: https://github.com/miguelgrinberg/python-socketio/issues/190#issuecomment-405113349