crosswords/server/main.py

23 lines
505 B
Python
Raw Normal View History

2021-06-17 16:12:16 +02:00
import ssl
import logging
2021-06-17 16:02:50 +02:00
from . import json_websockets
from . import crossword_connection
2021-06-17 16:12:16 +02:00
try:
cert_file = "fullchain.pem"
key_file = "privkey.pem"
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ssl_context.load_cert_chain(cert_file, keyfile=key_file)
except Exception as e:
logging.error("no ssl context available")
ssl_context = None
2021-06-17 16:02:50 +02:00
server = json_websockets.JsonWebsocketServer(
2021-06-17 16:12:16 +02:00
crossword_connection.CrosswordConnection, ssl_context=ssl_context
2021-06-17 16:02:50 +02:00
)
2021-06-17 16:12:16 +02:00
server.run()