Use cases
Remote configuration
Eventvisor can help control the flow of events emitting out of your applications via remote configuration, allowing your changes to take effect instantly without requiring you to deploy your applications again.
Deployment strategy#
On its own, Eventvisor does not impose any opinion on how you deploy your project's generated datafiles.
You can choose to:
- Hardcode generated datafiles in your application code, or
- Deploy them separately to a CDN, that your applications can fetch in runtime
The second option is preferred if you wish to benefit from remotely controlling your applications.
Learn more in deployment page.
Fetching datafiles#
In your application, you are expected to fetch the datafiles from the CDN in runtime.
For example, in JavaScript application, you can do:
import { createInstance } from "@eventvisor/sdk";const DATAFILE_URL = "https://cdn.yoursite.com/eventvisor-tag-web.json";const datafile = await fetch(DATAFILE_URL).then(res => res.json());const eventvisor = createInstance({ datafile: datafile,});
Learn more in JavaScript SDK page.
Refreshing datafile#
The idea of remotely controlling your applications mean also updating the datafile while your application is already running.
Eventvisor SDK can help you here via its setDatafile()
method:
// fetch againconst latestDatafile = await fetch(DATAFILE_URL).then(res => res.json());eventvisor.setDatafile(latestDatafile);
When to refresh#
Your datafile refreshing strategy can be achieved in three different ways:
- periodically, like every 15 minutes or so
- manually fetching and setting datafile after a specific user activity, or
- listening to a webhook or WebSocket event in your application, and refreshing it on demand
Modules set up#
It is important to understand that if your latest configuration is making use of any new modules, then your application is expected to be set up properly early on to honour them.