RightMesh / meshIM

An on- or off-line messaging app powered by RightMesh!
GNU General Public License v3.0
17 stars 8 forks source link

Store messages when the sender/recipient is offline and send them when online. #19

Open FrazerSeymour opened 6 years ago

FrazerSeymour commented 6 years ago

Currently meshIM users can only send messages when both parties are online, and if either party disconnects unexpectedly messages can be in a weird state where they are considered sent but never received.

Once "message received" events are in RightMesh, we need to save whether or not a message has been received, and attempt to resend once both parties are online.

FrazerSeymour commented 6 years ago

I'm envisioning an extra boolean "sent" column in the Messages table, and some query like SELECT * FROM Messages WHERE Sent = 0 AND MeshID = :meshId that can be run when on the PeerDiscoveredEvent.

FrazerSeymour commented 6 years ago

I'm not sure if we should store a separate timestamp for when a user pressed "send" on the message and when the message actually sent, if there's a value to that or not.

compscidr commented 6 years ago

A subsequent "version" of this would be when @sriks1 has the merge request in the library ready for delivery confirmation. Then it would also be possible to resend data if the user goes offline before you get a received event. Perhaps this is something better handled by the library in the long run though - when you call a sendReliable, the library internally stores the data stream in a db until the received event is confirmed, it retries when a meshid goes offline. then from the app dev perspective, just hitting send always gets it there every time, despite online / offline drops.

FrazerSeymour commented 6 years ago

Yeah it will eventually be replaced as RightMesh functionality, but for now this is a good end-user functionality.

Good thought on the delivery confirmation point. :+1: Right now it would just be considered "sent" on sendDataReliable.