Skip to content

nexmo-community/js-express-drop-in-audio

Repository files navigation

JavaScript Client SDK Drop in Audio Chat Server

Nexmo is now known as Vonage

This is a JavaScript project that creates a HTTP server for the Vonage Conversation API. This project was built to be used with an accompanying app, learn more about both projects on our blog.

A Swift version of this server is available on GitHub.

Welcome to Vonage

If you're new to Vonage, you can sign up for a Vonage API account and get some free credit to get you started.

Prerequisites

  • NPM

  • Node

Running the project

Remix on Glitch

You can open the project on Glitch and the project will be deployed for you.

Add your private.key file to the root folder.

Add your Vonage Application ID to the new .env file.

Remix on Glitch

Locally

After cloning the project to your machine change into the project directory.

Install the dependencies with npm install.

Copy the .env.example file to a new .env file with cp .env.example > .env and add your Vonage Application ID to the new .env file.

Add your private.key file to the root folder.

Once done, run node server.js and the server will be accessible on port 3000.

Endpoints

The project serves to 3 endpoints:

  • /auth (POST):

This returns a JWT to log the Client SDK in.

Request Body:

{
  "name": "value" // String - username
}

Request Reponse:

{
  "name": "value", // String - username
  "jwt": "value" // String - JWT for the username
}
  • /rooms (GET):

This returns a list of open chat rooms.

Request Reponse:

[
  {
    "id": "value", // String - ID for the room/conversation
    "display_name": "value" // String - Name for the room/conversation
  },
  {
    "id": "value", // String - ID for the room/conversation
    "display_name": "value" // String - Name for the room/conversation
  }
]
  • /rooms (POST):

This allows the app to create a new room.

Request Body:

{
  "display_name": "value" // String - Name for the room/conversation
}

Request Reponse:

{
  "id": "value" // String - ID for the room/conversation
}

Getting Help

We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:

Further Reading

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published