Xirsys Access Token API

A serverless API endpoint for securely providing TURN access to WebRTC clients.

Xirsys is one of the few original pioneers of WebRTC infrastructure with their TURN Server offerings. Today, they've extended their services to custom installation and hosting of practically all the possible WebRTC servers in the world including Jitsi video bridge, Janus video room, Medooze, LiveSwitch, and Kurento media server. With a footprint in 11 data centers across the world, they are the most versatile and reliable WebRTC hosting solution on the market.

Xirsys is built upon patented technology providing a distributed deployment architecture for advanced reliability, scalability and extendability. This creates superior uptime and allows for arbitrary 3rd party software to quickly become part of the Xirsys service and accessible through the API.

How It Works

The Xirsys function endpoint substitutes a web server for providing WebRTC clients with tokens for TURN provider access. Conventionally, a website's server will be the secure granter of access, by providing temporary access tokens to clients. This way, malicious app developers cannot hijack your company's Xirsys account, racking up video streaming bandwidth on your Xirsys bill.

PubNub Functions takes the web server hosting component out of the equation for the equation for the developer, by making the service serverless. Think of this custom API as a microservice, hosted in the cloud, that can be deployed instantly with the click of a button.

The Xirsys endpoint you deploy with PubNub Functions provides two REST actions:

- A GET route that returns a temporary token (60 minute TTL). A client can request Xirsys credentials for up to 1 hour after they retrieve a token.

- A PUT route that returns a list of ICE servers and temporary credentials from Xirsys. The client must provide a valid token to this route. The token distribution and TTL is handled entirely by the PubNub Functions KV Store.

Before deploying, you must:

  • Sign up for a Xirsys account

  • Get your Xirsys channel, ident, and secret from the Xirsys dashboard

  • Login or Register to Admin Portal

    • Select Functions

    • Select your desired App and Keyset

    • Select "Explore Templates" and proceed with selected integration.

    • Add API Key and channel

  • Make sure the event type is "On Request"

  • Click the copy URL button and paste the URL into your client application code

  • Read this WebRTC with Xirsys tutorial for a more in-depth walkthrough.

GET Request

The GET and PUT HTTP requests can be made to the Function endpoint URL. The get request returns a 1-hour life token, which can be used to make a PUT request to the same API. The PUT request will return WebRTC TURN server access credentials for Xirsys.

1

PUT Request

The PUT request will return WebRTC TURN server access credentials for Xirsys. For more on web development with these credentials, take a look at the MDN website documentation on WebRTC and TURN.

1

Talk to an expert