Proxy for websocket

anandlramadurg
Proxy for KiteConnect ( http ) works fine while for KiteTicker , it doesnt work. Is there way to suppy proxy for it?

com.neovisionaries.ws.client.WebSocketException: Failed to connect to 'ws.kite.trade:443': Connection timed out: connect
at com.neovisionaries.ws.client.SocketConnector.doConnect(SocketConnector.java:136)
at com.neovisionaries.ws.client.SocketConnector.connect(SocketConnector.java:83)
at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2152)
at com.zerodhatech.ticker.KiteTicker.connect(KiteTicker.java:214)
at com.anand.zerodha.algo.strategy.ITMStrangleStrategy$StrategyEntryTask.run(ITMStrangleStrategy.java:218)
at java.util.TimerThread.mainLoop(Unknown Source)
Tagged:
  • sujith
    You can refer to this thread.
  • anandlramadurg
    Thanks. But i dont understand why this fix cannot be added to your java client library. Rest client is taking care of proxy while kiteticker doesnt. Looks like inconsistent library. Some folks are from IT background and they usually have proxy in office.
  • anandlramadurg
    its fine. I got this working after modifying the library.
  • anandlramadurg
    Its simple change. Incase you want to put this in the library.
    WebSocketFactory sf = new WebSocketFactory();
    if (proxyHost != null && proxyPort != 0) {
    sf.getProxySettings().setHost(proxyHost);
    sf.getProxySettings().setPort(proxyPort);
    }
    ws = sf.createSocket(wsuri);
Sign In or Register to comment.