diff --git a/public_html/css/style.css b/public_html/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/public_html/index.html b/public_html/index.html new file mode 100644 index 0000000..7900342 --- /dev/null +++ b/public_html/index.html @@ -0,0 +1,16 @@ + + + + + + InstantChat + + + + +

InstantChat

+ + + + + diff --git a/public_html/js/client.js b/public_html/js/client.js new file mode 100644 index 0000000..e69de29 diff --git a/server/chatserver.py b/server/chatserver.py new file mode 100755 index 0000000..684604e --- /dev/null +++ b/server/chatserver.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Example code from: +# https://websockets.readthedocs.io/en/stable/intro.html + +import asyncio +import websockets + + +async def hello(websocket, path): + name = await websocket.recv() + print(f"< {name}") + + greeting = f"Hello {name}!" + + await websocket.send(greeting) + print(f"> {greeting}") + +start_server = websockets.serve(hello, 'localhost', 8765) + +asyncio.get_event_loop().run_until_complete(start_server) +asyncio.get_event_loop().run_forever()