You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
update websocket examples
This commit is contained in:
@@ -9,8 +9,8 @@ host = 'ws.postman-echo.com'
|
||||
port = 443
|
||||
handshake_path = '/raw'
|
||||
# Option: echo.websocket.events (unreliable)
|
||||
# host = 'echo.websocket.events'
|
||||
# handshake_path = '/'
|
||||
#host = 'echo.websocket.events'
|
||||
#handshake_path = '/'
|
||||
|
||||
try:
|
||||
addr_info = socket.getaddrinfo(host, port)[0][-1]
|
||||
|
||||
@@ -15,7 +15,8 @@ import asyncio
|
||||
try:
|
||||
URL = sys.argv[1] # expects a websocket echo server
|
||||
except Exception:
|
||||
URL = "ws://echo.websocket.events"
|
||||
# URL = "ws://echo.websocket.events" # also works
|
||||
URL = "wss://echo.websocket.events"
|
||||
|
||||
|
||||
sslctx = False
|
||||
@@ -24,6 +25,7 @@ if URL.startswith("wss:"):
|
||||
try:
|
||||
sslctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
sslctx.verify_mode = ssl.CERT_NONE
|
||||
#sslctx.verify_mode = ssl.CERT_REQUIRED # doesn't work because OSError: (-30336, 'MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user