I agree with Connor, first try to build this and then post specific questions.
For your chat app I would suggest having a look at pusher from the appstore to get you started: https://appstore.home.mendix.com/link/app/107957/Mendix/Pusher