Open mrxz44 opened 1 day ago
Try modifying stream_ig.py and replace "ConsoleLogLevel.INFO" with "ConsoleLogLevel.DEBUG". It should log some details. Note that the DEBUG log is verbose when a connection is in place, hence the change should be reverted once the connection issue is sorted out.
Thanks @dario-weswit ! looks like the issue with SSL certificate here:
----------------------HIT CR TO UNSUBSCRIBE AND DISCONNECT----------------------
2024-10-22 09:26:16.848797|DEBUG|lightstreamer.stream|LS_IO|WS event: error(Cannot connect to host apd.marketdatasystems.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:992)')])
Exception: Cannot connect to host apd.marketdatasystems.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:992)')]
Called from <unknown>._wrap_create_connection (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py line 1077)
Called from <unknown>._create_direct_connection (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py line 1312)
Called from <unknown>._create_direct_connection (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py line 1343)
Called from <unknown>._create_connection (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py line 1009)
Called from <unknown>.connect (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/connector.py line 556)
Called from <unknown>._request (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/client.py line 661)
Called from <unknown>._ws_connect (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/client.py line 935)
Called from <unknown>.__aenter__ (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/client.py line 1357)
Called from <unknown>._connectAsync (/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/lightstreamer/client/com_lightstreamer_net.py line 144)
2024-10-22 09:26:16.854070|WARN |lightstreamer.session|Thread-2 (_hx_local_0)|Websocket suspended
2024-10-22 09:26:16.854142|DEBUG|lightstreamer.stream|Thread-2 (_hx_local_0)|WS disposing
2024-10-22 09:26:16.854221|ERROR|lightstreamer.session|Thread-2 (_hx_local_0)|Retrying connection. Cause: Websocket transport not available
I'm on mac m1 pro, is there anything specific to do with ssl?
It is recommended to avoid using a self-signed certificate for a public server. However, if you own the certificate, you can install it in the Lightstreamer library with the following steps:
sslcontext = ssl.create_default_context(cafile='cert.crt')
sslcontext.load_cert_chain(certfile='cert.crt', keyfile='cert.key')
LightstreamerClient.setTrustManagerFactory(sslcontext)
In this example, 'cert.crt' is the path to the certificate in PEM format, and 'cert.key' is the path to the private key. See also: Python ssl module and LightstreamerClient.setTrustManagerFactory
Hi, anyone having issues with stream? I've tried sample 'stream_ig.py' with Live account credentials and looks like there is something with websocket connection.