---
title: Flow control configuration for WebSocket API
description: API Security Enforcer (ASE) flow control is configured separately for each API using the API JSON file.
component: pingintelligence
version: 5.2
page_id: pingintelligence:pingintelligence_reference_guide:pingintelligence_flow_control_configuration_websocket_api
canonical_url: https://docs.pingidentity.com/pingintelligence/5.2/pingintelligence_reference_guide/pingintelligence_flow_control_configuration_websocket_api.html
revdate: April 3, 2024
section_ids:
  flow-control-cli-for-websocket-api: Flow control CLI for WebSocket API
---

# Flow control configuration for WebSocket API

API Security Enforcer (ASE) flow control is configured separately for each API using the API JSON file.

Here are the flow control related definitions in an API JSON file:

```json
{
 "api_metadata": {
 "protocol": "ws",

 "flow_control": {
 "client_spike_threshold": "0/second",
 "bytes_in_threshold": "0/second",
 "bytes_out_threshold": "0/second",
 "server_connection_queueing" : false
 },
 "servers": [
 {
 "host": "127.0.0.1",
 "port": 8080,
 "server_connection_quota": 10
 },
 {
 "host": "127.0.0.1",
 "port": 8081,
 "server_connection_quota": 20
 }
 ]
 }
}
```

The flow control section includes definitions which apply globally across all servers running the defined WebSocket API. These are `client_spike_threshold`, `bytes_in_threshold`, `bytes_out_threshold`, and `server_connection_queueing`. Server specific definitions include `server_connection_quota` which is configured on each individual server. The default is no flow control with all values set to zero. Note that different values can be specified for each server for `server_connection_quota`.

|   |                                                                                                                                  |
| - | -------------------------------------------------------------------------------------------------------------------------------- |
|   | If server connection quota is set to zero for one server, then it must be zero for all other servers in the API JSON definition. |

|   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| - | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | API security must be enabled for ASE flow control to work. For more information on enabling API security using the configuration file, see [Defining an API using API JSON configuration file in inline mode](pingintelligence_defining_api_json_configuration_inline.html). For more information on using the command-line interface (CLI), see [Enabling and disabling real-time API cybersecurity](pingintelligence_configuring_realtime_api_cybersecurity.html). |

## Flow control CLI for WebSocket API

ASE CLI can be used to update flow control parameters:

**Update Client Spike Threshold:**

Enter the following command to update the client spike threshold:

```
update_client_spike_threshold {api_id} {+ve digit/(second|minute|hour)}
```

For example: `update_client_spike_threshold shop_api 5000/second`

**Update Bytes-in**

```
update_bytes_in_threshold {api_id} {+ve digit/(second|minute|hour)}
```

For example: `update_bytes_in_threshold shop_api 8096/second`

**Update Bytes-out**

```
update_bytes_out_threshold {api_id} {+ve digit/(second|minute|hour)}
```

For example: `update_bytes_out_threshold shop_api 8096/second`

**Update Server Quota**

`update_server_connection_quota {api_id} \{host:port}\{+ve digit}`

For example: `update_server_connection_quota shop_api 5000`

|   |                                                                                                                                                                                                                                   |
| - | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | API security must be enabled for ASE flow control to work. For more information on enabling API security, see [Enabling and disabling real-time API cybersecurity](pingintelligence_configuring_realtime_api_cybersecurity.html). |
