the posted code would never do that, unless you send
status: X from arduino, and then the if equals “X” will never work.
you not posted the arduino code,
not posted the arduino IDE Montor print
not posted the console print
so lots of guessing here