JavaScript Library for the Real-Time State API

This JavaScript library is provided to facilitate use of the socket-based real-time state API in a browser (see Protocol of the Real-Time State API). It simplifies interactions with the API in the following ways:

  • Direct interaction with the WebSocket API is not necessary.
  • The connection, authentication, and table registration steps are handled for you using the credentials, B Series Appliance information, and table names you provide.
  • The server's JSON messages are buffered and decoded automatically.
  • Model changes are provided as JavaScript objects instead of JSON strings.
  • Several methods of subscribing to model changes are provided to help filter, transfer, and store the data more easily.

Browser Requirements

This API will only work in browsers that support binary WebSockets.


To use this JavaScript library, your HTML page must reference the state.js file located on your BeyondTrust Appliance B Series.

A script tag would look something like the example below, where "" is your B Series Appliance's hostname:

<script src=""></script>

This script tag must be included in your HTML page before any of your own code that uses the API.

Examples in this document use a simple script tag and the API’s global BomgarState() function. However, state.js also contains a universal module definition (UMD) wrapper that allows it to be used with various JavaScript module systems such as Browserify or RequireJS.