Greetings from ShepHertz!!!!
You will be getting Bad Request in getOnlineUsers() API, because of User is disconnect from the server. So you need to connect again. In this case if you alse call disConnect APi you will get Bad Request because User is disconnected earlier.
If you are getting bad request in response you can check connection State if user is disconnected you need to call the connect API.
Let me know if it helps.