Error while connecting web socket "Error while connecting. Message: Unable to connect to the remote"

tejas16892
I am using c# and trying to connect web socket on windows 10, also passed correct api key and access token, while connecting its showing the "Error while connecting. Message: Unable to connect to the remote server"
  • sujith
    Can you post the complete log and let us know what is the version of Kite Connect client you are using?
  • tejas16892
    once "ticker.Connect();" this line is executed its control flow gets into "OnError" method with error message as "Error while connecting. Message: Unable to connect to the remote server", version is 3.0.0
  • sujith
    You need to enable debugging and check.
  • tejas16892
    tejas16892 edited March 2018
    how to debug the code, i am using zerodha kite connect sdk
  • sujith
    It means you are not sending a valid access_token. You need a get a new access token and pass it.
  • tejas16892
    Both the apikey and access token is correct but every time its showing this errors
    Error: Error while connecting. Message: Unable to connect to the remote server
    Error: Error while connecting. Message: The remote server returned an error: (403) Forbidden.
    Closed ticker
  • tonystark
    Can you private message your API key and Access Token? And which version of .Net KiteConnect library are you using?
  • tejas16892
    tejas16892 edited March 2018
    i am simply executing this method provided in Zerodha reference code, the api key and access token passed is also correct but as soon as ticket.connect() is executed following errors pop up in console, version of library is 3.0.0
    is there any step i am missing or forgot to do?

    Error message
    Error: Error while connecting. Message: Unable to connect to the remote server
    Error: Error while connecting. Message: The remote server returned an error: (403) Forbidden.
    Closed ticker

    Code of a .net console app

    static void Main(string[] args)
    {
    initTicker();
    }
    private static void initTicker()
    {
    ticker = new Ticker(//api key, // access token);

    ticker.OnTick += OnTick;
    ticker.OnReconnect += OnReconnect;
    ticker.OnNoReconnect += OnNoReconnect;
    ticker.OnError += OnError;
    ticker.OnClose += OnClose;
    ticker.OnConnect += OnConnect;
    ticker.OnOrderUpdate += OnOrderUpdate;

    ticker.EnableReconnect(Interval: 1, Retries: 1);

    ticker.Connect();


    // Subscribing to NIFTY50 and setting mode to LTP
    ticker.Subscribe(Tokens: new UInt32[] { 256265 });
    ticker.SetMode(Tokens: new UInt32[] { 256265 }, Mode: Constants.MODE_LTP);
    }
Sign In or Register to comment.