This repository was archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 282
This repository was archived by the owner on Mar 28, 2023. It is now read-only.
Failable chat messages #1093
Copy link
Copy link
Open
Labels
featureFeature or enhancement to openbazaar-goFeature or enhancement to openbazaar-go
Description
Chat messages are currently persisted after successfully sending the message to the remote peer. In the cases where the remote peer is offline or the node is in a high-latency environment a message may take several minutes to be successfully sent. In these cases, the chat messages appear to be persisted immediately after posting the message, but if a user were switch away and revisit the view, the recently posted message may not appear if the message has not been successfully sent at the time.
Solution:
- we return from posting new chat messages as soon as possible (without waiting for the send to complete) ensuring that the message ID is returned in response
- ensure the websocket returning early with the completed state of the chat request does not race the requesting call (prefer to ensure a race condition can be handled (see Add ID Parameter to Async Socket Calls #925) or design to prevent the race condition if we can't)
- we will reorder the operations in our chat API (within
{specify api endpoints to include groupchat as well as regular chat}) to persist the message to the local DB immediately regardless of the successful delivery of the message. - we will migrate our schema to add a
failed_reasonnon-nullable text column to thechatDB table which describes the reason for the message delivery failure. - unsuccessful message delivery should populate DB record(s) w
failed_reasonwith the cause of the failure - unsuccessful message delivery should generate a socket notification (
body to be defined) - successful message delivery should generate a socket notification (
body to be defined) (optional) -
/ob/chatmessagesresponse should include a new key to present this failed state to the UI
{
"message": "Tes #8",
"messageId": "QmWepAACQP3vcoXRrhz1HNftiE5G3eRKZZtgikwnXhabUE",
"outgoing": true,
"peerId": "",
"read": false,
"failed": // string or bool?
"subject": "QmRWDYgYTxqAJk4URoxJD2NvzkrJ3vtSWEoZY1WmS5esAs",
"timestamp": "2018-08-16T11:38:58-04:00"
},
UI impact:
- Must represent
failedstate (and reason?) to the user - Must accept failure/success message delivery socket notifications
- Must return immediately to minimize open-connections within the UI
Metadata
Metadata
Assignees
Labels
featureFeature or enhancement to openbazaar-goFeature or enhancement to openbazaar-go