get messages from db on rendering