How to add chat (text message conversation) while video call in my application?

I am using insecure JS in my rails app for front end work. And for the back-end using REST API. I checked the open vidu demo (https://demos.openvidu.io/openvidu-call). It has chat (text message conversation) enable.
How to do it in insecure js code?

Hi,
Please, check how to share data between users and how to send messages.

This ifno is all you need to implement a chatting system in your app with OpenVidu.

Cheers