########################################################################################## LOC-14: Record and return Failure States ########################################################################################## Issue Type: New Feature ----------------------------------------------------------------------------------------- Issue Information ==================== Priority: Major Status: Closed Resolution: Done (2018-05-16 10:07:51) Project: LocalChat (LOC) Reported By: btasker Assigned To: btasker Components: - Server Targeted for fix in version: - V0.0.2 Time Estimate: 0 minutes Time Logged: 0 minutes ----------------------------------------------------------------------------------------- Issue Description ================== Currently, if a client is kicked out of a chat, they'll simply see a "Server Went Away" message. In the background, the client's calls to pollMsg will continue but result in a 403. Exactly the same will happen if a room is closed. This issue is to implement a new workflow for cases where a client was previously authorised and now isn't. The aim is to allow a HTTP 200 to be returned - just once - in order to provide the client with some information about the failure (i.e. "You have been kicked from the room" etc). We'll need a new table - FailureStates - and to adjust the code paths that can result in a 403. When a de-authorised client's request comes in, we should check FailureStates to see if their username and room ID are in there. If it is, we should return a HTTP 200 with the JSON payload set to report the reason for the failure (maybe just "status":"kicked" etc). We should then delete that row, so that on the next request (if there is one) the client receives a HTTP 403 (as now). Upon receipt of one of these statuses, the client should clear it's screen, print an informational message and stop the background message poll. In essence, it needs to trigger all the actions it would if the user had typed /leave ----------------------------------------------------------------------------------------- Activity ========== ----------------------------------------------------------------------------------------- 2018-05-16 09:50:37 git ----------------------------------------------------------------------------------------- -- BEGIN QUOTE -- Repo: LocalChat Host:Rimmer commit 87071b8dc402a10607c3d791f627854704878932 Author: B Tasker