working v1
This commit is contained in:
commit
5b54f3f636
19 changed files with 403 additions and 0 deletions
27
server.py
Normal file
27
server.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# 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)
|
||||
Loading…
Reference in a new issue