def on_open(self, ws):
self.login(self.user, self.password, api_id=<NUM_LIT:1>)<EOL>self.database(api_id=<NUM_LIT:1>)<EOL>self.cancel_all_subscriptions()<EOL>if len(self.on_object):<EOL><INDENT>self.set_subscribe_callback(self.__events__.index("<STR_LIT>"), False)<EOL><DEDENT>if len(self.on_tx):<EOL><INDENT>self.set_pending_transaction_callback(self.__events__.index("<STR_LIT>"))<EOL><DEDENT>if len(self.on_block):<EOL><INDENT>self.set_block_applied_callback(self.__events__.index("<STR_LIT>"))<EOL><DEDENT>if self.subscription_accounts and self.on_account:<EOL><INDENT>self.accounts = self.get_full_accounts(self.subscription_accounts, True)<EOL><DEDENT>if self.subscription_markets and self.on_market:<EOL><INDENT>for market in self.subscription_markets:<EOL><INDENT>self.subscribe_to_market(<EOL>self.__events__.index("<STR_LIT>"), market[<NUM_LIT:0>], market[<NUM_LIT:1>]<EOL>)<EOL><DEDENT><DEDENT>def ping(self):<EOL><INDENT>while <NUM_LIT:1>:<EOL><INDENT>log.debug("<STR_LIT>")<EOL>self.get_objects(["<STR_LIT>"])<EOL>time.sleep(self.keep_alive)<EOL><DEDENT><DEDENT>self.keepalive = threading.Thread(target=ping, args=(self,))<EOL>self.keepalive.start()<EOL>
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