├── .gitignore ├── .gitmodules ├── README.md ├── requirements.txt └── server.py /.gitignore: -------------------------------------------------------------------------------- 1 | venv 2 | .vscode 3 | .DS_Store -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "game"] 2 | path = game 3 | url = https://github.com/arpitbbhayani/game-of-life 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Game of Life - Engine 2 | --- 3 | 4 | ``` 5 | git clone --recurse-submodules https://github.com/arpitbbhayani/game-of-life-engine 6 | ``` 7 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp==3.6.2 2 | aiohttp-index==0.1 3 | async-timeout==3.0.1 4 | attrs==19.3.0 5 | chardet==3.0.4 6 | Click==7.0 7 | idna==2.8 8 | itsdangerous==1.1.0 9 | Jinja2==2.11.1 10 | MarkupSafe==1.1.1 11 | multidict==4.7.4 12 | netifaces==0.10.6 13 | python-engineio==3.11.2 14 | python-socketio==4.4.0 15 | six==1.14.0 16 | Werkzeug==1.0.0 17 | yarl==1.4.2 18 | -------------------------------------------------------------------------------- /server.py: -------------------------------------------------------------------------------- 1 | from aiohttp import web 2 | from aiohttp_index import IndexMiddleware 3 | 4 | import socketio 5 | 6 | sio = socketio.AsyncServer() 7 | app = web.Application(middlewares=[IndexMiddleware()]) 8 | sio.attach(app) 9 | 10 | 11 | @sio.event 12 | def connect(sid, environ): 13 | print("connect ", sid) 14 | 15 | 16 | @sio.event 17 | async def chat_message(sid, data): 18 | print("message ", data) 19 | await sio.emit('reply', room=sid) 20 | 21 | @sio.event 22 | def disconnect(sid): 23 | print('disconnect ', sid) 24 | 25 | 26 | async def api(request): 27 | text = "Hello, World!" 28 | return web.Response(text=text) 29 | 30 | 31 | app.router.add_get('/api', api) 32 | app.router.add_static('/', 'game') 33 | 34 | 35 | if __name__ == '__main__': 36 | web.run_app(app, host="0.0.0.0", port="4003") 37 | --------------------------------------------------------------------------------