abc-messenger/server.py
Andrew Gundersen 5b54f3f636 working v1
2020-11-21 14:43:17 -06:00

27 lines
No EOL
506 B
Python

# server.py
import asyncio
import websockets
import session
HOST = "localhost"
PORT = 8764
# Makes instance of a Messenger session for every client that connects.
async def launch_session(connection, path):
s = session.Session(connection)
await asyncio.gather(
s.do_agent_intents(),
s.deliver_mail()
)
# Run run for every new connection.
async def lift():
print(f"Listening for connections on {HOST}:{PORT}")
await websockets.serve(launch_session, HOST, PORT)