Testing and Production
You can experiment with OpenTok, and prototype your app, using only the OpenTok JavaScript library (or the OpenTok ActionScript library). You do not need the OpenTok server-side libraries to get started.
When you are ready to deploy your app, you need to take some additional steps to get everything up and running.
Working in the staging environment
You can get started building your app, using the OpenTok JavaScript library only. (Or, if you are a Flash developer, you need to use the OpenTok ActionScript library only.)
- Request an API key from TokBox at the "Get your API key" page (for JavaScript developers or for ActionScript developers).
- Build your test app using the OpenTok JavaScript library loaded from the
following URL:
<script src="http://staging.tokbox.com/v0.91/js/TB.min.js"></script>. - You can use the
'devtoken'or'moderator_token'test token strings when calling theconnect()method of the Session object (defined in the OpenTok JavaScript library). (The'moderator_token'string was added in OpenTok v0.91.5.) When you are ready to move the app to production, you will need to generate authentication tokens for individual users, using the server-side API. For more information, see Connection token creation. You can also use the OpenTok server-side libraries to obtain a token string but you don't need to. If you do use the server-side libraries to generate a session ID, make sure that theAPI_URLconstant in the library you use is set to"https://staging.tokbox.com/hl". See Connection token creation.
You can load a specific version of the OpenTok API by modifying
the version number in the src attribute of the JavaScript script element.
For more information, see the OpenTok
JavaScript API reference.
ActionScript developers: ActionScript developers must compile using the staging version of the opentok.swc file. See the Downloads page.
iOS developers: Set the environment by using the [OTSession initWithSessionId:delegate:environment:] message.
You can run your test app from a web page on the local filesystem. You do not need to load it onto a web server. However, you may need to configure Flash Player to allow the app to load content from remote network sources:
- Open this link in a new browser window: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html.
- In the "Always trust files in these locations" list click the "Edit locations" link and select "Add location".
- Click Browse for folder, navigate to the folder that contains the files you downloaded, and then click the Open button.
- Click the Always Allow button.
- Reload the local version of the HTML file in your web browser.
The Flash Player Global Security Settings panel is displayed.
This grants the HTML pages in the folder you selected to communicate with Flash content served by tokbox.com. (It also grants this communication from this folder to other servers, so be careful to select a specific folder.)
Note: When using the OpenTok staging environment, archives are limited to 5 minutes in length. Archives in the staging environment are deleted after 3 days. (For more information on archiving, see Archiving).
Building a production version of your app
When you are ready to roll out your app, you need to do the following:
- Register your application at the Launch page for JavaScript developers or for ActionScript developers.
- Build your test app using the OpenTok JavaScript library loaded from the
following URL:
<script src="http://static.opentok.com/v0.91/js/TB.min.js"></script>. - Use the OpenTok server-side libraries to generate session IDs.
Make sure that the
API_URLconstant in the library you use is set to"https://api.opentok.com/hl". See Session Creation. - Use the OpenTok server-side libraries to obtain token strings to validate users. (In the
production version of your app, you cannot use the
'devtoken'or'moderator_token'test token strings.) Make sure that theAPI_URLconstant in the library you use is set to"https://api.opentok.com/hl". See Connection token creation.
You can load a specific version of the OpenTok API by modifying
the version number in the src attribute of the JavaScript script element.
For more information, see the OpenTok JavaScript library reference.
ActionScript developers: Compile using the production version of the opentok.swc file. See the Downloads page.
iOS developers: Set the environment by using the [OTSession initWithSessionId:delegate:environment:] message.
Note that the URLs for the JavaScript library and the API_URL constant
differ in the test sandbox and production versions of your app:
- Staging value
- JavaScript source URL: http://staging.tokbox.com/v0.91/js/TB.min.js
- Server-side library API_URL: https://staging.tokbox.com/hl
- Production value
- JavaScript source URL: http://static.opentok.com/v0.91/js/TB.min.js
- Server-side library API_URL: https://api.opentok.com/hl
Note also that the JavaScript URL uses http, whereas the API_URL
value used in the server-side libraries uses https.
If your page loads via HTTPS, be sure to load the OpenTok JavaScript library using HTTPS as well. Otherwise the browser will display a warning to the user. Use the following URLs to load the libary via HTTPS:
- In staging
<script src="https://staging.tokbox.com/v0.91/js/TB.min.js" ></script> - In production
<script src="https://swww.tokbox.com/v0.91/js/TB.min.js" ></script>
You should maintain an internal test version of you application that uses the test sandbox. You can test using this version of your application with new versions of the OpenTok API. To learn when new versions of the OpenTok API become available, join the TokBox Announcements forum.
IRC Live Chat
Have a quick question? Chat with other developers. Join chat
TokBox staff may not be online right now. To reach them during off-hours, visit the forums.