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_HTTPneeds to be set to
trueto enable the feature.
HTTP_CONFIG_PATHcan 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:
POLLING_FREQUENCYis the default polling frequency for everything not explicitly set.
POLLING_INTERVAL_MAPallows 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_MAPis slightly more complex, it's used to accelerate the polling frequency temporarily for a set of queries each time specific events occur. The keys need to be valid
eventson 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
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:
dev:webpack": "cross-env NODE_ENV=development API_HOST=some-host HTTP_CONFIG_PATH=$npm_package_config_HTTP_CONFIG_PATH webpack serve --open"