25 lines
518 B
Python
25 lines
518 B
Python
import asyncio
|
|
import logging
|
|
import websockets
|
|
|
|
from config import LOCAL_HOST, LOCAL_PORT
|
|
from websocket_client import handle_connection
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s [%(levelname)s] %(message)s",
|
|
datefmt="%H:%M:%S",
|
|
)
|
|
|
|
|
|
async def main():
|
|
await websockets.serve(handle_connection, LOCAL_HOST, LOCAL_PORT)
|
|
await asyncio.Future()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
try:
|
|
asyncio.run(main())
|
|
except KeyboardInterrupt:
|
|
logging.info("Shutting down...")
|