Invalid feed token or client code on smartapigo


  • Following code stopped working after password change issue. Using MPIN in place of password. Same uname+pin+totp working on python. Getting following in smartapigo

    Error:  Invalid feed token or client code
    

    @admin Note in example websocket/example dont have update for totp in generate session. Plesae update

    code_text
    ABCClient  := smartApi.New("ANGEL_USER_NAME"),"ANGEL_PWD","ANGEL_API_KEY")
    session, err := ABCClient.GenerateSession(Otp now)
        if err != nil {
    		fmt.Println(err.Error())
    		return
    	}
    
    	fmt.Println("User Session Tokens :- ", session.UserSessionTokens)
    
    
        session.UserSessionTokens, err = StelebotClient.RenewAccessToken(session.RefreshToken)
    
    socketClient = websocket.New(session.ClientCode, session.FeedToken, "nse_cm|17963&nse_cm|3499&nse_cm|11536&nse_cm|21808&nse_cm|317")
    
    socketClient.Serve()
    

  • @admin Thanks for providing the update;

    Any tentative plan to upgrade the SDK of SmartAPI Go for Websocket2 streams?

    Github's smartapigo repo has the last commit of Oct 2022.
    OR
    We need to make the change in our local code only?

    Please share some information about this so that we can plan this update in our code.


  • HI @nbmaiti

    We have released a new version (2.0) of Websocket that includes several improvements and enhancements over the previous version (1.0). To upgrade to Websocket 2.0, you can follow the instructions in our documentation. If you have any questions or need help with the upgrade, you can reach out to the community or other users of Websocket 2.0 for assistance. To read more about the same, please read this post --> https://smartapi.angelbroking.com/topic/1861/user-feedback-websocket-2-0-beta-rollout-python-language

    Please note that the old version (1.0) of smartwebsocket has been deprecated and is no longer supported.

    Thank you.


  • Definitely go backend misbehaving. I am not removing subscription list, just closing websocket while exiting the app. Please please respond @admin / any user

    First time run

    /app # /usr/bin/angel_ws 
    Credentials: UID PIN apikey
    User Session Tokens :-  {eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6Ik44MjgxNyIsInJvbGVzIjowLCJ1c2VydHlwZSI6IlVTRVIiLCJpYXQiOjE2NzI5MTQ3NzksImV4cCI6MTc1OTMxNDc3OX0.EWgg3GaxWApYyvkfDsgkfJDo5Y0YvD3Ijcn9GyCJTjVgH5RXuwcLbVdCI1XS_glciCvP2y9mHUIVCZdfIBfmCg eyJhbGciOiJIUzUxMiJ9.eyJ0b2tlbiI6IlJFRlJFU0gtVE9LRU4iLCJpYXQiOjE2NzI5MTQ3Nzl9.hg7Tjr9dgISFinyDL43zO-VB9arV1OvANp-otmWYF2wWkotdUFe0ucBWZ5xy4LcMJWdepFH-LmMQje3-b6l1XQ 0802811807}
    User Profile:
    
    
    {UID CLIENT NAME MAITI    [CNC NRML MARGIN MIS BO CO]  [mcx_fo ncx_fo nse_fo nse_cm bse_cm]}
     
    &{<nil> {wss  <nil> wsfeeds.angelbroking.com /NestHtml5Mobile/socket/stream  false   } {<nil> <nil> <nil> <nil> <nil> <nil>} true 300 60000000000 7000000000 0 nse_cm|17963&nse_cm|3499&nse_cm|11536&nse_cm|21808&nse_cm|317 0802811807 UID}
    
    ws Connected
    Message Received :- [map[e:nse_cm ltt:NA name:sf tk:21808] map[name:tm tvalue:05/01/2023 16:03:56] map[e:nse_cm ltt:NA name:sf tk:317] map[e:nse_cm ltt:NA name:sf tk:3499] map[e:nse_cm ltt:NA name:sf tk:11536] map[e:nse_cm ltt:NA name:sf tk:17963]]
    

    Same binary , just restarted its non responsive
    NON working case

    /app # /usr/bin/angel_ws 
    Credentials: UID PIN apikey
    User Session Tokens :-  {eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6Ik44MjgxNyIsInJvbGVzIjowLCJ1c2VydHlwZSI6IlVTRVIiLCJpYXQiOjE2NzI5MTUxMjMsImV4cCI6MTc1OTMxNTEyM30.QnAlSbPZWeY0rlwf0AlQowsLTEIrUg2j0dlehm9ai99RXw9g2NgNHEtoiboYYnucPN02ipX884vYNPvmvgNJEQ eyJhbGciOiJIUzUxMiJ9.eyJ0b2tlbiI6IlJFRlJFU0gtVE9LRU4iLCJpYXQiOjE2NzI5MTUxMjN9.TnciuQ4riyp4YQ853dHlAaBWNZzki31zx4ge_7QUlUw_c7_PmVD7MY77z8oCA11wiN7g6oh_QqAKyiZA88Fbcw 0862637450}
    User Profile:
    
    {UID CLIENT NAME MAITI    [CNC NRML MARGIN MIS BO CO]  [mcx_fo ncx_fo nse_fo nse_cm bse_cm]}
    FeedTokens:  
    
    &{<nil> {wss  <nil> wsfeeds.angelbroking.com /NestHtml5Mobile/socket/stream  false   } {<nil> <nil> <nil> <nil> <nil> <nil>} true 300 60000000000 7000000000 0 nse_cm|17963&nse_cm|3499&nse_cm|11536&nse_cm|21808&nse_cm|317 0802811807 UID}
    
    Error:  Invalid feed token or client code