Navigation

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

    Web socket scripts stop at random times

    Python SDK
    5
    43
    249
    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.
    • S
      Surya 1 @admin last edited by

      @admin

      I have tested the new SDK.. so far it passed all my stress tests.. I will continue my testing and I will keep it posted. Thanks to the team. Very good job.

      1 Reply Last reply Reply Quote 0
      • J
        jiwan1986 @admin last edited by

        @admin I'm also testing the new SDK, no issues till now. Thanks for quick issue resolution.

        1 Reply Last reply Reply Quote 0
        • punit
          punit last edited by

          @admin @rjbanna Thanks. Moved to new SDK 1.2.3 now... Thanks for support

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

            @Ashok

            Pease note new SDK needs changes to the script. You need to add ws.websocket_connection() to on_connect

            from smartapi import WebSocket 
            FEED_TOKEN= "your feed token"
            CLIENT_CODE="your client Id"
            token="channel you want the information of" #"nse_cm|2885&nse_cm|1594&nse_cm|11536"
            task="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.websocket_connection() 
                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( )
            
            punit 1 Reply Last reply Reply Quote 0
            • punit
              punit @Surya 1 last edited by punit

              @rajanprabu Noted Rajan.. bhavesh informed me about that...

              1 Reply Last reply Reply Quote 0
              • J
                jiwan1986 @admin last edited by

                @admin Today also I got heartbeat failed message.

                punit 1 Reply Last reply Reply Quote 0
                • punit
                  punit @jiwan1986 last edited by

                  @rjbanna Same here.

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

                    @Ashok @rjbanna

                    with new SDK on MCX ?

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

                      @rajanprabu Yes

                      punit 1 Reply Last reply Reply Quote 0
                      • punit
                        punit @jiwan1986 last edited by

                        @admin , Any update on this? Facing exact same issues still. ws is not reliable at all.

                        S A 2 Replies Last reply Reply Quote 0
                        • S
                          Surya 1 @punit last edited by

                          @Ashok

                          Im running from morning and I dint face any issue. @rjbanna what about you ?

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

                            Hi @Ashok can you post the snip here.

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

                              @admin

                              {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-30 13:59:11.170880'}
                              {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-30 13:59:11.171432'}
                              {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-30 13:59:11.171963'}
                              {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-30 13:59:11.172687'}
                              [2021/03/30 13:59:11] HeartBeats Failed
                              [2021/03/30 13:59:11] HeartBeats Failed
                              [2021/03/30 13:59:12] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:12'}
                              [2021/03/30 13:59:12] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:12'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:12'}
                              [2021/03/30 13:59:12] HeartBeats Failed
                              [2021/03/30 13:59:12] HeartBeats Failed
                              [2021/03/30 13:59:13] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:13'}
                              [2021/03/30 13:59:13] HeartBeats Failed
                              [2021/03/30 13:59:13] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:13'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:13'}
                              [2021/03/30 13:59:13] <function on_connect at 0x7ff5b750d5e0>
                              {'task': 'cn', 'channel': '', 'token': '0921225492', 'user': 'REHR1010', 'acctid': 'REHR1010'}
                              {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-30 13:59:13.286596'}
                              {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-30 13:59:13.287143'}
                              [2021/03/30 13:59:13] HeartBeats Failed
                              [2021/03/30 13:59:13] HeartBeats Failed
                              [2021/03/30 13:59:13] HeartBeats Failed
                              [2021/03/30 13:59:14] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:14'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:14'}
                              [2021/03/30 13:59:14] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:14'}
                              [2021/03/30 13:59:14] HeartBeats Failed
                              [2021/03/30 13:59:14] HeartBeats Failed
                              [2021/03/30 13:59:14] HeartBeats Failed
                              [2021/03/30 13:59:14] HeartBeats Failed
                              [2021/03/30 13:59:14] <function on_connect at 0x7ff5b750d5e0>
                              {'task': 'cn', 'channel': '', 'token': '0921225492', 'user': 'REHR1010', 'acctid': 'REHR1010'}
                              {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-30 13:59:15.025724'}
                              {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-30 13:59:15.026091'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:15'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:15'}
                              [2021/03/30 13:59:15] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:15'}
                              [2021/03/30 13:59:15] HeartBeats Failed
                              [2021/03/30 13:59:15] HeartBeats Failed
                              [2021/03/30 13:59:15] HeartBeats Failed
                              [2021/03/30 13:59:15] HeartBeats Failed
                              [2021/03/30 13:59:15] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:16'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:16'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:16'}
                              [2021/03/30 13:59:16] HeartBeats Failed
                              [2021/03/30 13:59:16] HeartBeats Failed
                              [2021/03/30 13:59:16] HeartBeats Failed
                              [2021/03/30 13:59:16] HeartBeats Failed
                              [2021/03/30 13:59:16] HeartBeats Failed
                              [2021/03/30 13:59:17] HeartBeats Failed
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:17'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:17'}
                              {'name': 'tm', 'tvalue': '30/03/2021 13:59:17'}
                              [2021/03/30 13:59:17] HeartBeats Failed
                              [2021/03/30 13:59:17] HeartBeats Failed
                              [2021/03/30 13:59:17] HeartBeats Failed
                              [2021/03/30 13:59:17] HeartBeats Failed
                              [2021/03/30 13:59:17] HeartBeats Failed
                              [2021/03/30 13:59:17] HeartBeats Failed
                              [2021/03/30 13:59:17] HeartBeats Failed
                              [2021/03/30 13:59:18] HeartBeats Failed

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

                                Hi @Ashok we will update you on this.

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

                                  @rajanprabu @Ashok I also didn't face this issue today. It's working fine for me.

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

                                    @rjbanna @Ashok

                                    I got HeartBeat failed message three times today so far.. is it running well for you guys ? It may be my network

                                    A J 2 Replies Last reply Reply Quote 0
                                    • A
                                      admin @Surya 1 last edited by

                                      Hi @rajanprabu we will test it from our end and revert you back.

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

                                        @rajanprabu I got it one time today.

                                        punit 1 Reply Last reply Reply Quote 0
                                        • punit
                                          punit @jiwan1986 last edited by punit

                                          @rjbanna @rajanprabu , Yes I got it many times today.
                                          I do not suspect network here. Zerodha ws is working on same set-up without any stoppage or issues.

                                          {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-31 14:24:40.171811'}
                                          {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-31 14:24:40.173677'}
                                          {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-31 14:24:40.173925'}
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats FailedHeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats FailedHeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-31 14:24:40.325233'}
                                          {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-31 14:24:40.326658'}
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-31 14:24:40.329653'}
                                          {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-31 14:24:40.330938'}
                                          {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-31 14:24:40.332719'}
                                          {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-31 14:24:40.334177'}
                                          {'ak': 'ok', 'msg': 'connected', 'task': 'cn', 'ts': '2021-03-31 14:24:40.360006'}
                                          {'ak': 'ok', 'msg': 'heartbeat', 'task': 'hb', 'ts': '2021-03-31 14:24:40.361450'}
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats FailedHeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats FailedHeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats FailedHeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats FailedHeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats FailedHeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:40] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats FailedHeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          {'name': 'tm', 'tvalue': '31/03/2021 14:24:41'}
                                          {'name': 'tm', 'tvalue': '31/03/2021 14:24:41'}
                                          {'name': 'tm', 'tvalue': '31/03/2021 14:24:41'}
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed
                                          [2021/03/31 14:24:41] HeartBeats Failed

                                          A S 2 Replies Last reply Reply Quote 0
                                          • A
                                            admin @punit last edited by

                                            Hi @Ashok we are running web socket from last 2 hours we will update you on the issue.

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