Applications which utilise chat can be incredibly complex, especially if you want real-time chat, notifications and idle/online/offline statuses.
Look at firechat it’s an open source project and demonstrates the functionality available using the firebase platform https://www.firebase.com/blog/2013-07-09-announcing-firechat.html