Developers

Introduction

This is a quick, server-side example of how to secure your Xirsys credentials using Node.js to query the Xirsys API. You will want to be sure to secure your Xirsys credentials and token in a secure environment to avoid having your bandwidth and security compromised.
In our Getting Started guide, we show how to initiate a connection client-side as an example for learning purposes, however, you will want keep your ICE requests server-side for production. Although we are using Node.js in this example, you can also use other technologies like PHP, Java, C# or whatever you prefer.

Prerequisites

We are assuming you’ve created a Xirsys account and know the basics on creating a room path to your account. To understand the Xirsys basics, please follow our Getting Started tutorial here before continuing.

Install Node.js

Download and install node.js and create a server.js file in your node working directory.

Add Your ICE Request

Open the server.js file in any text editor like Sublime, and copy this code into it, which is your ICE request:

Update Your Credentials

Update the creds object in the ICE request you just pasted, using your account information respectively. If you’re not sure how to get that information, please see our Getting Started tutorial here before continuing.

Run Your ICE Call

Now that you’ve added your account credentials to the object, your ICE call should run successfully.

Open a Terminal window in MAC or a DOS prompt if you’re on a PC and change the directory to the location of your server.js file.

In your Terminal / DOS window enter:

You should see a resulting ICE String in your window:

icestring

Troubleshooting

If you get an unauthorized error, you might need to check your account information – be sure you used the right data. Remember the ident is your username, not your email. Be sure you created your domain, application and room in your Xirsys dashboard and correctly spelled out the names.

Advanced Demo

To see a more advanced working model of this node example see: https://github.com/xirdev/xirsys-nodejs