Navigation

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

    Im getting error in websocket

    Python SDK
    2
    2
    36
    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.
    • D
      Dasamiya299 last edited by

      Im using the same code for websocket as in the example -

      ## WebSocket
      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() # 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( )
      

      But I get error like -

      07-04-2021 20:16:01 -DEBUG-Connection error: 1006 - connection was closed uncleanly (I dropped the WebSocket TCP connection: 'WebSocket' object has no attribute 'websocket_connection')
      07-04-2021 20:16:01 -DEBUG-Connection closed: 1006 - connection was closed uncleanly (I dropped the WebSocket TCP connection: 'WebSocket' object has no attribute 'websocket_connection')
      

      Please fix it.

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

        Hi @keer2405 we have noted your issue and reported to the team we will update you on this.

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