Currently messages are lost if the server restarts since it's all just in memory. Add some kind of storage backend. Most reliable would be some kind of write-through cache, though you could also just have some kind of periodic flushing to storage.
The solution here needs to take into account:
Encrypted messages at rest.
The possibility of using the Signal protocol or something like it.
Having multiple chat server instances.
Sharding storage.
etc.
All of these can come later though and should comprise their own issues.
Currently messages are lost if the server restarts since it's all just in memory. Add some kind of storage backend. Most reliable would be some kind of write-through cache, though you could also just have some kind of periodic flushing to storage.
The solution here needs to take into account:
All of these can come later though and should comprise their own issues.