core
core copied to clipboard
Use an API route for sending chat messages.
We are currently using the WebSocket connection for receiving and sending chat messages. Sending messages has a small client bug when the message the server broadcasts is different from the one you sent (eg. your message was truncated). The client tries to infer which message has just completed sending by comparing the message text. Truncated messages will then always show as if they're still sending.
Instead of building some RPC system on the WebSocket, we can use HTTP requests and respond with the generated message ID, so the client can reliably find the message that was sent.
(Need to test this with the client a bit, I think we may need to support a client-generated ID instead.)
Closes https://github.com/u-wave/core/issues/57
Coverage increased (+0.4%) to 78.386% when pulling a7b45372685ad4027da10995761198c1a97ae4ee on http-chat into 9d54904c9f6f44820f167d0b4dd7e8531bbd86f9 on default.
This will also need to first guarantee that the user is actually connected…