Receiving a Signal
Signals are received on the session. When a Signal is received, in addition to the data that was sent, it will contain a from property which will have information about who sent the Signal. This can be used to differentiate between Signals the current user and sent and ones they receive.
- Copy the following code and paste it at the bottom of the
initializeSession()function:
This code creates variables to reference the message history div from the earlier html page, and then listens for Signals. Once a signal is received, it is appended to the message history div. The session.on(signal) listener allows you to listen to all Signals in the session. Since the messages in our app are being sent with the msg type, we are listening only for those Signals.
Basic text chat
Follow this tutorial to build basic text chat from scratch using the Vonage Video API. It is the quickest way to build a proof of concept for this functionality on the video platform.