WebSocket Not returning any quote info


  • @admin ,

    I am using below c# code, seems websocket is not working at all.. please find below code,

            SmartApi connect = new SmartApi(api_key, JWTToken, RefreshToken);
    
            OutputBaseClass obj = new OutputBaseClass();
            wholeData = new List<DataModel>();
            //Login by client code and password
            obj = connect.GenerateSession(Client_code, Password);
            AngelToken sagr = obj.TokenResponse;
    
            //Get Token
            obj = connect.GenerateToken();
            sagr = obj.TokenResponse;
    
            WebSocket _WS = new WebSocket();
            var exitEvent = new ManualResetEvent(false);
    
            _WS.ConnectforStockQuote(sagr.feedToken, Client_code);
            if (_WS.IsConnected())
            {
                obj = connect.getPosition();
                GetPositionResponse position = obj.GetPositionResponse;
                string script = "";
                foreach (PositionData p in position.data)
                {
                    wholeData.Add(new DataModel
                    {
                        Token = p.symboltoken,
                        Qty = p.sellqty + p.buyqty,
                        scrip = p.tradingsymbol,
                        Price = "0"
                    });
                    script = script+ "nse_fo|" + p.symboltoken + "&";
    
                }
               // script = nse_fo | 50068 & nse_fo | 50058 &
               _WS.RunScript(sagr.feedToken, Client_code, script, "mw");
                _WS.MessageReceived += WriteResult;
      
            }
            exitEvent.WaitOne();
        }
        static void WriteResult(object sender, MessageEventArgs e)
        {
            Console.WriteLine("Tick Received : " + e.Message);
        }
    

    Note: i took updated sdk few minutes back.

    065b3a2c-fb2a-4891-960a-5d1a5ae22e16-AngelWebsocket_Fail.JPG


  • HI @divakar620 We will get back to you our team is working on websocket.