Open ghost opened 8 years ago
FIFO stack is called queue or Deque ;) - but the idea seems pretty nice.
I see that the "shout" message (from the server to the client) doesn't include a timestamp... thus, the client has the responsibility to label each message with the time that it was received, rather than the server remembering when it was received from the originating client. Sending the saved messages to a new client would be less meaningful than if they had a timestamp to provide some context.
It's not a crux to add time stamps. Timestamps are usually longs. In this case a lot can be omitted, meaning that the time stamp would be a few characters to a message.
Right, I wasn't worried about the additional payload only that this would likely mean a change to the protocol.
It looks like the client simply ignores any messages it doesn't recognize. If that's the case it might make sense to add a new message, eg:
CatchupShout
The current "Shout" protocol would not need to change. The client would continue to handle the timestamping of the messages as it currently does.
Since all clients are web-based, it's not a long-term issue. Just update all clients once and the problem goes away on it's own. Chaitu does let all people who run a client know in advance when a protocol change takes place. So it is a minor problem.
It would be nice if the server saved the last few (say 20) chat messages (in a FIFO stack). Then when a client connects the server could serve up those last 20 messages.