Saving messages into array to show previous messages when someone joins to the chat