JavaScript

Testing your Code in a Browser

At this point, your app.js file should look something like this (with a few adjustments):

In your completed code, you should have hard coded values to replace YOUR_APP_ID, YOUR_SESSION_ID and YOUR_TOKEN — if you haven't done this, see Setting up authentication above.

  1. Open the index.html file in your browser by double-clicking on it.
  2. Enter some text into the form and send it.
  3. You should see the message get added to the message history.

Next, we can test what it looks like if someone else sends a message. While our code is not reachable from the internet, we can simulate that by opening this page in another window.

  1. Copy the URL in the address bar of your browser.
  2. Open a new window or tab, and paste in the address to open the file.
  3. Enter some text into the form and send it.
  4. You should see a second message get added to the message history.

Troubleshooting tip: If you cant send and receive messages, open the "console" tab in your browser tools (command+option+i on Mac, CTRL+i on Windows) and check for errors. The most likely issue is that your API key, session ID, or token is not set up properly. Since you hard coded your credentials, it's also possible that your token has expired.

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