Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Websocket is not working

    Bugs
    4
    14
    222
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rohithmaccs last edited by rohithmaccs

      I have been testing this for the past few weeks? I people suggested that i am using wrong feed token or client id. i am triple sure about the feed token and the client id.they are cent percent correct. Today i tested in my market hours. I found that still i m gettting wrong data
      {"task":"mw","channel":"bse_cm|532921","token":"09959834","user": "R308253","acctid":"R308253"}
      this is the request to the web socket
      [{"ak":"nk","task":"mw","msg":"mw"}]
      this is the response
      any issue with this req para to the websocket

      A S 2 Replies Last reply Reply Quote 0
      • James Bond
        James Bond last edited by

        Can you share your code ?

        “Bond. James Bond.”

        A 1 Reply Last reply Reply Quote 0
        • A
          admin @rohithmaccs last edited by

          hi @rohithmaccs Share your contact details to solve your issues.

          R 1 Reply Last reply Reply Quote 0
          • S
            Surya 1 @rohithmaccs last edited by Surya 1

            @rohithmaccs

            If you have updated to the recent SDK.. You need to modify the script to have task included..

            sample script below.. pay attention to task='mw' and ws.send_request(token,task)

            ## WebSocket
            from smartapi import WebSocket 
            FEED_TOKEN= "your feed token"
            CLIENT_CODE="your client Id"
            token="nse_cm|2885&nse_cm|1594&nse_cm|11536"
            task='mw' #|'sfi'|'dp'
            ss = WebSocket(FEED_TOKEN, CLIENT_CODE)
            
            def on_tick(ws, tick):
                print("Ticks: {}".format(tick))
            
            def on_connect(ws, response):
                ws.send_request(token,task)
            
            def on_close(ws, code, reason):
                ws.stop()
            
            # Assign the callbacks.
            ss.on_ticks = on_tick
            ss.on_connect = on_connect
            ss.on_close = on_close
            
            ss.connect( )
            
            S James Bond 2 Replies Last reply Reply Quote 0
            • S
              Surya 1 @Surya 1 last edited by

              @rohithmaccs

              Please dont roll back the SDK, otherwise this wont work.. This modification is true only smartapi-python version 1.2.2 onwards..

              R 1 Reply Last reply Reply Quote 0
              • R
                rohithmaccs @admin last edited by

                @admin 9995527391, rohithmaccs@gmail.com

                1 Reply Last reply Reply Quote 0
                • R
                  rohithmaccs @Surya 1 last edited by rohithmaccs

                  @rajanprabu said in Websocket is not working:

                  Please dont roll back the SDK, otherwise this wont work.. This modification is true only smartapi-python version 1.2.2 onwards..

                  Hi i am a react-native dev(mobile app dev).so the node js sdk wont works for me since many of the packages are missing or in other name. so i gone through your code. and made in a form for me to work.i am following exactly same as the node js version
                  here you are providing example of python ver 1.2.2 for me for javascript the latest updated version is 1.0.9

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Surya 1 @rohithmaccs last edited by

                    @rohithmaccs

                    Im sorry for the oversight.

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      Surya 1 @Surya 1 last edited by

                      I didnt check the header that its NodeJs.

                      R 1 Reply Last reply Reply Quote 0
                      • R
                        rohithmaccs @Surya 1 last edited by

                        @rajanprabu because of you i checked their repo.and found that it is updated 4 days ago .. i will check whether i missed any updates thanks

                        1 Reply Last reply Reply Quote 0
                        • James Bond
                          James Bond @Surya 1 last edited by

                          @rajanprabu said in Websocket is not working:

                          task='mw' #|'sfi'|'dp'

                          Do you find any documentation for this change ?

                          “Bond. James Bond.”

                          R 1 Reply Last reply Reply Quote 0
                          • R
                            rohithmaccs @James Bond last edited by

                            @James-Bond solved thanks

                            A 1 Reply Last reply Reply Quote 0
                            • A
                              ayush3630 @rohithmaccs last edited by

                              @rohithmaccs how did u solved it please help me? I am getting same response

                              1 Reply Last reply Reply Quote 0
                              • A
                                ayush3630 @James Bond last edited by

                                @James-Bond please help me i am also getting same response As of written in this post.

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post