# WS server that sends messages every second import asyncio import datetime import random import websockets import ssl async def time(websocket, path): while True: with open('/var/www/html/folds.html') as myinput: folds = myinput.read() print(folds) await websocket.send(folds) await asyncio.sleep(1) start_server = websockets.serve(time, "0.0.0.0", 5678) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever()