39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
import asyncio
|
|
import websockets
|
|
import ssl
|
|
import sys
|
|
|
|
async def test_connect(url):
|
|
print(f"Testing connection to: {url}")
|
|
try:
|
|
# Create a custom SSL context that ignores certificate validation errors
|
|
ssl_context = ssl.create_default_context()
|
|
ssl_context.check_hostname = False
|
|
ssl_context.verify_mode = ssl.CERT_NONE
|
|
|
|
async with websockets.connect(url, ssl=ssl_context) as websocket:
|
|
print(f"SUCCESS: Connected to {url}")
|
|
await websocket.close()
|
|
return True
|
|
except Exception as e:
|
|
print(f"FAILED: Could not connect to {url}. Error: {e}")
|
|
return False
|
|
|
|
async def main():
|
|
urls_to_test = [
|
|
"wss://10.6.80.12:31581",
|
|
"ws://10.6.80.12:31581",
|
|
"wss://10.6.80.12:31581",
|
|
"ws://10.6.80.12:31581",
|
|
]
|
|
|
|
print("--- Starting LiveKit Connection Probe ---")
|
|
for url in urls_to_test:
|
|
if await test_connect(url):
|
|
print(f"\nFOUND WORKING URL: {url}")
|
|
break
|
|
print("--- Probe Finished ---")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|