{"action":"created","issue":{"url":"https://api.github.com/repos/aaugustin/websockets/issues/49","labels_url":"https://api.github.com/repos/aaugustin/websockets/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/aaugustin/websockets/issues/49/comments","events_url":"https://api.github.com/repos/aaugustin/websockets/issues/49/events","html_url":"https://github.com/aaugustin/websockets/issues/49","id":65208071,"number":49,"title":"Document how you serve both websockets and a aiohttp server on the same port.","user":{"login":"Natim","id":229453,"avatar_url":"https://avatars.githubusercontent.com/u/229453?v=3","gravatar_id":"","url":"https://api.github.com/users/Natim","html_url":"https://github.com/Natim","followers_url":"https://api.github.com/users/Natim/followers","following_url":"https://api.github.com/users/Natim/following{/other_user}","gists_url":"https://api.github.com/users/Natim/gists{/gist_id}","starred_url":"https://api.github.com/users/Natim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Natim/subscriptions","organizations_url":"https://api.github.com/users/Natim/orgs","repos_url":"https://api.github.com/users/Natim/repos","events_url":"https://api.github.com/users/Natim/events{/privacy}","received_events_url":"https://api.github.com/users/Natim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-30T13:11:05Z","updated_at":"2015-04-06T17:48:14Z","closed_at":null,"body":"I'd like to have some HTTP pages alongside my websocket handler.\r\n\r\nHow should I integrate?\r\n\r\nWould this works?\r\n\r\n```\r\n#!/usr/bin/env python\r\n\r\nimport asyncio\r\nfrom aiohttp import web\r\nimport websockets\r\n\r\n@asyncio.coroutine\r\ndef hello(websocket, path):\r\n    name = yield from websocket.recv()\r\n    print(\"< {}\".format(name))\r\n    greeting = \"Hello {}!\".format(name)\r\n    yield from websocket.send(greeting)\r\n    print(\"> {}\".format(greeting))\r\n\r\n@asyncio.coroutine\r\ndef handle(request):\r\n    name = request.match_info.get('name', \"Anonymous\")\r\n    text = \"Hello, \" + name\r\n    return web.Response(body=text.encode('utf-8'))\r\n\r\n@asyncio.coroutine\r\ndef init_http_server(loop):\r\n    app = web.Application(loop=loop)\r\n    app.router.add_route('GET', '/{name}', handle)\r\n\r\n    srv = yield from loop.create_server(app.make_handler(),\r\n                                        '127.0.0.1', 8080)\r\n    print(\"Server started at http://127.0.0.1:8080\")\r\n    return srv\r\n\r\n\r\n\r\nloop = asyncio.get_event_loop()\r\n\r\nwebsocket_server = websockets.serve(hello, 'localhost', 8765)\r\nhttp_server = init_http_server(loop)\r\n\r\nloop.run_until_complete(websocket_server)\r\nloop.run_until_complete(http_server)\r\n\r\nloop.run_forever()\r\n```"},"comment":{"url":"https://api.github.com/repos/aaugustin/websockets/issues/comments/90171017","html_url":"https://github.com/aaugustin/websockets/issues/49#issuecomment-90171017","issue_url":"https://api.github.com/repos/aaugustin/websockets/issues/49","id":90171017,"user":{"login":"aaugustin","id":788910,"avatar_url":"https://avatars.githubusercontent.com/u/788910?v=3","gravatar_id":"","url":"https://api.github.com/users/aaugustin","html_url":"https://github.com/aaugustin","followers_url":"https://api.github.com/users/aaugustin/followers","following_url":"https://api.github.com/users/aaugustin/following{/other_user}","gists_url":"https://api.github.com/users/aaugustin/gists{/gist_id}","starred_url":"https://api.github.com/users/aaugustin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaugustin/subscriptions","organizations_url":"https://api.github.com/users/aaugustin/orgs","repos_url":"https://api.github.com/users/aaugustin/repos","events_url":"https://api.github.com/users/aaugustin/events{/privacy}","received_events_url":"https://api.github.com/users/aaugustin/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T17:48:14Z","updated_at":"2015-04-06T17:48:14Z","body":"This project doesn't aim at providing an HTTP server."}}