27 lines
No EOL
506 B
Python
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) |