Issue with running WebSocket in Python

suyogm
Hi,

I am using the very basic sample python code to connect to WebSocket, but am unable to make a successful connection. The code just exits without starting a continuous Thread in background. It does not even call the 'on_connect' callback method

After debugging a bit, I was able to detect an exception when creating a 'socket' instance. The error message is as follows:

hostname 'websocket.kite.trade' doesn't match either of 'api.kite.trade', 'www.api.kite.trade'

Normal kite connect APIs are working fine and I am also able to ping 'websocket.kite.trade' from my Windows 7 PC.

Can you think of any obvious configuration or setting that I might have missed to get this error? It will take me some time to configure cygwin, and would prefer to test using curl only when all other options are exhausted.
Please guide on fixing this error.
  • suyogm
    on further troubleshooting, it seems that the WebSocket was able to connect when initialized as follows:
    kws.connect(False, True)

    So, some issues with certificates, it seems. I am trying to connect from my local machine only.
    Would like to know if there is any better way of addressing this issue.
  • Kailash
    https://websocket.kite.trade <-- Do you get a certificate error when you open this URL in a browser? (Please try Firefox and Chrome)
  • suyogm
    No certificate error on any browser..
  • Kailash
    Looks like there's an issue with the certificate trust store on your machine then.
  • Vivek
    @suyogm Other users have already reported this issue on os like Ubuntu 14.04. Please update openssl version and check again.
Sign In or Register to comment.