asyncio.ensure_future(listen_for_message(websocket))
if __name__ == '__main__':
    loop = asyncio.get_event_loop()
loop.run_until_complete(my_app())
loop.run_forever()
Make websocket callback asynchronous with asyncio