JavaScript

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.

  1. 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.

Steps
1
Overview
2
Before You Begin
3
Configure a Vonage Video Application
4
Creating the Project Folders and HTML Template
5
Setting Up Authentication
6
Connecting to the Session
7
Sending a Signal
8
Receiving a Signal
9
Testing your Code in a Browser
10
A little bit of CSS customization
11
Conclusion