This example illustrates various parameters that can be adjusted when using the on-premise device detection engine, and controls when a new data file is sought and when it is loaded by the device detection software.Three main aspects are demonstrated:
- Update on Start-Up
- Filesystem Watcher
- Daily auto-update
License Key
In order to test this example you will need a 51Degrees Enterprise license which can be purchased from our pricing page. Look for our "Bigger" or "Biggest" options.
Data Files
You can find out more about data files, licenses etc. at our (FAQ page)[//51degrees.com/resources/faqs]
Enterprise Data File
Enterprise (fully-featured) data files are typically released by 51Degrees four days a week (Mon-Thu) and on-premise deployments can fetch and download those files automatically. Equally, customers may choose to download the files themselves and move them into place to be detected by the 51Degrees filesystem watcher.
Manual Download
If you prefer to download files yourself, you may do so here:
Lite Data File
Lite data files (free-to-use, limited capabilities, no license key required) are created roughly once a month and cannot be updated using auto-update, they may be downloaded from (Github)[href=https://github.com/51Degrees/device-detection-data] and are included with source distributions of this software.
Update on Start-Up
You can configure the pipeline builder to download an Enterprise data file on start-up.
Pre-Requisites
- a license key
- a file location for the download
- this may be an existing file - which will be overwritten
- or if it does not exist must end in ".hash" and must be in an existing directory
Configuration
- the pipeline must be configured to use a temp file createTempDataCopy: true
- a DataFileUpdateService must be supplied dataUpdateService.on('updateComplete', function(status, dataFile) {// do something with the result.});...dataFileUpdateService: dataUpdateService
- update on start-up must be specified, which will cause pipeline creation to block until a file is downloaded updateOnStart: true
File System Watcher
You can configure the pipeline builder to watch for changes to the currently loaded device detection data file, and to replace the file currently in use with the new one. This is useful, for example, if you wish to download and update the device detection file "manually" - i.e. you would download it then drop it into place with the same path as the currently loaded file. That location is checked periodically (by default every 30 mins) and this frequency can be configured.
Pre-Requisites
- a license key
- the file location of the existing file
Configuration
- the pipeline must be configured to use a temp file createTempDataCopy: true
- a DataFileUpdateService must be supplied dataUpdateService.on('updateComplete', function(status, dataFile) {// do something with the result.});...dataFileUpdateService: dataUpdateService
- configure the frequency with which the location is checked, in seconds (10 mins as shown) pollingInterval: 10*60
Daily auto-update
Enterprise data files are usually created four times a week. Each data file contains a date for when the next data file is expected. You can configure the pipeline so that it starts looking for a newer data file after that time, by connecting to the 51Degrees distributor to see if an update is available. If one is, then it is downloaded and will replace the existing device detection file, which is currently in use.
Pre-Requisites
- a license key
- the file location of the existing file
Configuration
- the pipeline must be configured to use a temp file createTempDataCopy: true
- a DataFileUpdateService must be supplied dataUpdateService.on('updateComplete', function(status, dataFile) {// do something with the result.});...dataFileUpdateService: dataUpdateService
- Set the frequency in seconds that the pipeline should check for updates to data files. A recommended polling interval in a production environment is around 30 minutes. pollingInterval: 10*60
- Set the max amount of time in seconds that should be added to the polling interval. This is useful in datacenter applications where multiple instances may be polling for updates at the same time. A recommended ammount in production environments is 600 seconds. updateTimeMaximumRandomisation: 10*60
Location
This example is available in full on GitHub.
Required npm Dependencies:
- fiftyone.pipeline.core
- fiftyone.pipeline.engines
- fiftyone.pipeline.engines.fiftyone
- fiftyone.devicedetection.onpremise