Streaming APIs
Streaming APIsApplication Programming Interface. Refers to a set of functions, procedures, protocols, and tools that enable users to build application software. allow customers to subscribe to a select set of services instead of polling the NB API to get an aggregated state or statistics of the events. For example, with streaming APIs, the customers can get notifications about the following types of events:
- The UP and DOWN status of the devices
- Change in the location of APs
For a complete list of supported services, see the next section. With streaming API, the customers can write value-added applications based on the aggregated context.
API streaming is not supported on a single node clusters.
Supported Services
The streaming API supports the following services, for a definition of each of the services, see the next section.
- Location
- Security
- AppRF
- Audit
- Monitoring
Viewing the Streaming API Page
Perform the following steps to view the
page:- Log in to .
- Under , click the menu option.
- Click the
The following is an illustration of the
page:Figure 1 View of the Streaming API Page
The parameters in the page are described in the following table. Refer to the callout numbers.
Table 1: Parameters of the Streaming API Page
Callout
API Description 1
A list of available topics for streaming APIs. To receive streaming events from a topic, subscribe to the specific topic.
2
Enables Aruba Central to stream events for a specific topic when this box is enabled.
3
Definition of the specific topic. All WebSocket response messages are encapsulated in a protocol buffer, the format of which you can download.
4
Access token for establishing a WebSocket connection.
5
WebSocket endpoint address for the Aruba Central instance.
6
The protocol buffer in which all the incoming streaming messages are encapsulated. This protobuf is further used to identify the topic of the message received and decode the topic-specific protobuf message.
tab.
Subscribing or Unsubscribing a Streaming API Topic
To receive streaming events from a topic, first subscribe to the topic in Aruba Central.
Only Aruba Central admin users can subscribe to, or unsubscribe from, a topic.
To subscribe to a streaming API topic:
- Log in to .
- Under , click the menu option.
- Click the tab.
- In the
To unsubscribe a topic, clear the corresponding check box. The following topics are available for download:
- —The location messages publish the location of associated clients or rogues and these are published every 50 messages or 10 seconds apart.
- —When a new rogue is detected or a suspect is promoted to rogue, a rogue event is published to the streaming server.
- —AppRF stream is the flow of all the client sessions which is intra-internet bound happening in the network.
- —The Audit messages are sent to notify events like device connectivity, configuration status, and firmware status.
- —Monitoring publishes the messages about statistics and states of monitoring data.
tab, select the check box corresponding to the topic that you want to subscribe.
Downloading Protobuf Definition for a Streaming API topic
To download the protobuf definition, complete the following steps:
- Log in to .
- Under , click the menu option.
- Click the tab.
- In the table, click the button corresponding to the protobuf definition for the topic to which you have subscribed.
Decoding WebSocket Response Messages
All WebSocket response messages are encapsulated in a protocol buffer. When a message is received, use the subject (topic) to identify the message and invoke an appropriate message processor. To decode the message, refer to the protocol buffer specification of the respective topic.
The format is as follows:
Enabling Data Streaming From a Topic
Use the WebSocket endpoint and access token to establish a WebSocket connection and start streaming data for the topics to which you have enabled subscription. Create a WebSocket connection to enable API streaming from Aruba Central.
Complete the following steps to receive streaming events from Aruba Central:
- Create a WebSocket connection:
wss://<central-host>/streaming/api
- Set the following additional headers:
Header Description Username of the admin. This is an optional header.
Access token. For more information about how to generate the key, see Subscribing or Unsubscribing a Streaming API Topic.
Value of the topic to which you have subscribed. The value should be one of the following:
Location
Security
AppRF
Audit
Monitoring
- Start the read loop to read the events. The payload is a protocol buffer message.
Retrieving a New Token
The access token comes with a validity of seven days after which a new token needs to be generated.
You can retrieve the token either directly from the UI or by using the API.
- To retrieve the new access token from the Aruba CentralUI, complete the following steps:
- In the page, under , click tab. The page is displayed.
- You can retrieve the valid token from the field. The token gets refreshed automatically after seven days of its generation.
- To retrieve the new access token from the API, here are the details required:
- https://<central-host>/streaming/token/validate —
- GETGET refers HTTP request method or an SNMP operation method. The GET HTTP request method submits data to be processed to a specified resource. The GET SNMP operation method obtains information from the Management Information Base (MIB). —
- —Enter the current token
The API will return the same token if the old token is not expired or will return a new token in case the old token is expired.