LOC-14: Record and return Failure States



Issue Information

Issue Type: New Feature
 
Priority: Major
Status: Closed

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: LocalChat (LOC)
Resolution: Done (2018-05-16 10:07:51)
Target version: V0.0.2,
Components: Server ,

Created: 2018-05-14 09:07:29
Time Spent Working


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


Toggle State Changes

Activity


Repo: LocalChat
Host:Rimmer

commit 87071b8dc402a10607c3d791f627854704878932
Author: B Tasker <github@<Domain Hidden>>
Date: Wed May 16 09:23:04 2018 +0100

Commit Message: LOC-14 - Move error status code returning to a dedicated function

This is as a precursor to checking for a stored message for that user

server/LocalChat.py | 72 ++++++++++++++++++++++++++++++--------------------
1 files changed, 43 insertions(+), 29 deletions(-)


View Commit | View Changes
Repo: LocalChat
Host:Rimmer

commit 0557ce27ad76d6b5507212cb34d5edaa8eff0d8a
Author: B Tasker <github@<Domain Hidden>>
Date: Wed May 16 09:43:27 2018 +0100

Commit Message: LOC-14 System will now push a failuremessage when a user is kicked from a room

The message will be returned to the client just once, and is valid for 5 minutes (though clearance hasn't been implemented yet)

client/LocalChatClient.py | 8 ++++++++
server/LocalChat.py | 30 +++++++++++++++++++++++++++++-
2 files changed, 37 insertions(+), 1 deletions(-)


View Commit | View Changes
Repo: LocalChat
Host:Rimmer

commit 0addb47b99110f50eb952ba90978694420b06b33
Author: B Tasker <github@<Domain Hidden>>
Date: Wed May 16 09:48:25 2018 +0100

Commit Message: LOC-14 - Move failuremessage pushing to function

This is done as at some point we'll also want to push a "room has been closed" message. To do that though, we'll need to query all the users in the room, so leaving for now

server/LocalChat.py | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)


View Commit | View Changes
A new table failuremsgs has been added, and messages are currently pushed into there.

If the client receives a status of errmessage when calling pollMsg it'll remove the room related settings (and as a result stop polling), and print the error message in "reversed" format.

Closing this as done.
btasker changed status from 'Open' to 'Resolved'
btasker added 'Done' to resolution
btasker changed status from 'Resolved' to 'Closed'