Hi am working on a chat application, I want to sort new messages plus keeping the history order according to time.
For example, I have the chat messages in an array like this
[{"user":"a", "msg":"Hi ", "msg_count":1, "unix_time":"1474476800000"}
{"user":"b", "msg":"Hi ", "msg_count":1, "unix_time":"1478776800000"}
{"user":"c", "msg":"Hi ", "msg_count":5, "unix_time":"1479276800000"}
{"user":"d", "msg":"Hi ", "msg_count":1, "unix_time":"1478416800000"}
{"user":"e", "msg":"Hi ", "msg_count":3, "unix_time":"1478476800000"}]
How can I also sort them using the "msg_count" key where all greater values should come on the top but the remaining objects should be sorted with the "unix_time" key.