Adding a chat functionality, you can use Firebase or XMPP.
For choosing the right option you may prefer this
https://www.quora.com/Which-protocol-is-better-to-develop-a-chat-web-app-using-Firebase-XMPP-or-HTTP
OR
If you have strong knowledge of backend technologies, go ahead with your own. And the same time, there is also an instant solution available in the market that helps to integrate the additional functionality more easily.