Skip to main content
Version: Current

Web - Http Polling Mode

If the target environment does not support websockets the client can be configured to operate in http polling mode.

This is done by setting a few environment variables:

  • FORCE_HTTP needs to be set to true to enable the feature.
  • HTTP_CONFIG_PATH can be set to to a file path pointing to a file which will contain the configuration options in json format.

The configuration file itself will look something like this:

"ALL_TRADES": 2000,
"ALL_USERS": 3000,
  • POLLING_FREQUENCY is the default polling frequency for everything not explicitly set.
  • POLLING_INTERVAL_MAP allows us to set custom polling frequencies for different server resources, the keys of the map need to be valid resource names on the server and the values need to be positive integers (number of milliseconds).
  • POLLING_MAP is slightly more complex; it is used to accelerate the polling frequency temporarily for a set of queries each time specific events occur. The keys need to be valid events on the server and the values are maps themselves containing 3 key-value pairs:
    • TEMP_FREQUENCY: temporary accelerated frequency
    • AMOUNT_OF_POLLS: number of polls using the TEMP_FREQUENCY
    • QUERIES: the set of queries which will be affected

During development you can use cross-env to pass environment variables to your scripts.

In your package.json:

"config": {
"HTTP_CONFIG_PATH": "./http.config.json"
"scripts": {
dev:webpack": "cross-env NODE_ENV=development API_HOST=some-host HTTP_CONFIG_PATH=$npm_package_config_HTTP_CONFIG_PATH webpack serve --open"