code: def on_open(self, ws):
          
          self.login(self.user, self.password, api_id=1)
          self.database(api_id=1)
          self.cancel_all_subscriptions()
  
          # Subscribe to events on the Backend and give them a
          # callback number that allows us to identify the event
          if len(self.on_object):
              self.set_subscribe_callback(self.__events__.index("on_object"), False)
  
          if len(self.on_tx):
              self.set_pending_transaction_callback(self.__events__.index("on_tx"))
  
          if len(self.on_block):
              self.set_block_applied_callback(self.__events__.index("on_block"))
  
          if self.subscription_accounts and self.on_account:
              # Unfortunately, account subscriptions don't have their own
              # callback number
              self.accounts = self.get_full_accounts(self.subscription_accounts, True)
  
          if self.subscription_markets and self.on_market:
              for market in self.subscription_markets:
                  # Technially, every market could have it's own
                  # callback number
                  self.subscribe_to_market(
                      self.__events__.index("on_market"), market[0], market[1]
                  )
  
          # We keep the connetion alive by requesting a short object
          def ping(self):
              while 1:
                  log.debug("Sending ping")
                  self.get_objects(["2.8.0"])
                  time.sleep(self.keep_alive)
  
          self.keepalive = threading.Thread(target=ping, args=(self,))
          self.keepalive.start()
docs: This method will be called once the websocket connection is
              established. It will
  
              * login,
              * register to the database api, and
              * subscribe to the objects defined if there is a
                callback/slot available for callbacks