I made use websockets to get a websocket server. which is working perfectly fine. But now I want to use a secure connection using wss. here it says you can set the ssl keyword argument to a SSLContext to enable TLS.
and that is what I have done.
import asyncio
import websockets
import ssl
from subprocess import check_output
import sys
async def onConnect(websocket, path):
while 1:
msg = await websocket.recv()
from subprocess import check_output
out = check_output(["./wsscript.sh", msg])
resp = out.decode("utf-8")
print("< {}".format(resp))
await websocket.send("{}".format(resp))
ctx=ssl.create_default_context()
ctx.load_cert_chain('./cert.pem', './key.pem')
start_server = websockets.serve(onConnect, '10.220.1.2', 8765,ssl=ctx)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
But I cannot connect to the websocket anymore with using the SSLContext