Navigation

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

    How to stop websocket connection once we run it

    Python SDK
    2
    3
    70
    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.
    • M
      mukul.ietlucknow last edited by

      ss = SmartWebSocket(FEED_TOKEN, CLIENT_CODE)

      def on_message(ws, message):
      print("Ticks: {}".format(message))

      def on_open(ws):
      print("on open")
      ss.subscribe(task,token)

      def on_error(ws, error):
      print(error)

      def on_close(ws):
      print("Close")

      Assign the callbacks.

      ss._on_open = on_open
      ss._on_message = on_message
      ss._on_error = on_error
      ss._on_close = on_close

      ss.connect()

      lets says this is my code - for the websocket.

      now how can i stop stop or terminate this websocket connection.?

      M 1 Reply Last reply Reply Quote 0
      • M
        mukul.ietlucknow @mukul.ietlucknow last edited by

        @mukul-ietlucknow @admin please respond to the query. it is required else it runs all the time. please solve this issue

        D 1 Reply Last reply Reply Quote 0
        • D
          DevmarkD @mukul.ietlucknow last edited by

          @mukul-ietlucknow By any chance, did you find a solution for this?

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