From the discussion on #152, this proposal aims to:
- extend batching to data and html requests
- support/prefer static manifests
The benefits, in addition to the benefits of a static manifest, are that server traffic subsequent to the initial manifest load is also greatly reduced.
AppConfig.manifestUrl [mandatory] becomes a static url for retrieving the static manifest.
AppConfig.batchUrl [optional] is a new url for retrieving optionally supported batch functionality.
- F2 adds a new batch method with signature
F2.batch(url, params, type, [delay], [callback], [errback]) and opens up the batch request mechanism to
- Type can be
manifest(default), combo, html, data. A manifest request is a static manifest request. If data and html are provided for a static manifest request, then these should be non-changing values (for example, html for a waiting icon, or sample data for a demo App, with real data protected by authentication on a data request) A combo request is the current mix of manifest plus dynamic html and data.
- Like the existing
registerApps, batches are grouped by having a common batchUrl.
- The target server side
batchUrl knows how to decode a batch request into its component requests. This isn't spelled out in the current spec, but I think F2 needs to explicitly spell this out.
- The response is an array of static manifests, combination manifests, html, or data. Today, the response is an array of dynamic manifests only.
- The handling of each element of the response array is by either a user specified callback handler, or a default handler for the type. The default handler for the type
combo is just the current _loadApps(). Note how the _loadApps() takes an array of AppConfigs and an array of AppManifests which is just the response? Well, the handling of the combined response just takes an array of handers and the response's array of objects. Each AppConfig is easily made into a handler using something like var handler = new ComboManifestHandler(appConfig);
- Batch requests are given a slight delay so that multiple requests have a chance of being batched.
- An alternate signature for
batch could use a promise instead of explicit callback and errback parameters.
- The current batch loading of manifests is rewritten to use the new
F2.batch() to do the actual work
AppConfig.batchUrl should in most cases, be a remembered value from having read in AppManifest.batchUrl (or via some out-of-band communication, as it is currently). The manifest server indicates whether or not it supports batch requests by providing AppManifest.batchUrl. If provided, AppManifest,batchUrl != AppManifest.manifestUrl because the latter points to a static resource. However, the Container may implement its own batch request aggregation irregardless of whether the App Server does so by providing an AppConfig.batchUrl. In this case, AppConfig.batchUrl != AppManifest.batchUrl.
From the discussion on #152, this proposal aims to:
The benefits, in addition to the benefits of a static manifest, are that server traffic subsequent to the initial manifest load is also greatly reduced.
AppConfig.manifestUrl[mandatory] becomes a static url for retrieving the static manifest.AppConfig.batchUrl[optional] is a new url for retrieving optionally supported batch functionality.F2.batch(url, params, type, [delay], [callback], [errback])and opens up the batch request mechanism tomanifest(default),combo,html,data. Amanifestrequest is a static manifest request. Ifdataandhtmlare provided for a static manifest request, then these should be non-changing values (for example, html for a waiting icon, or sample data for a demo App, with real data protected by authentication on adatarequest) Acomborequest is the current mix of manifest plus dynamic html and data.registerApps, batches are grouped by having a commonbatchUrl.batchUrlknows how to decode a batch request into its component requests. This isn't spelled out in the current spec, but I think F2 needs to explicitly spell this out.combois just the current_loadApps(). Note how the_loadApps()takes an array of AppConfigs and an array of AppManifests which is just the response? Well, the handling of the combined response just takes an array of handers and the response's array of objects. Each AppConfig is easily made into a handler using something likevar handler = new ComboManifestHandler(appConfig);batchcould use a promise instead of explicit callback and errback parameters.F2.batch()to do the actual workAppConfig.batchUrlshould in most cases, be a remembered value from having read inAppManifest.batchUrl(or via some out-of-band communication, as it is currently). The manifest server indicates whether or not it supports batch requests by providingAppManifest.batchUrl. If provided,AppManifest,batchUrl!=AppManifest.manifestUrlbecause the latter points to a static resource. However, the Container may implement its own batch request aggregation irregardless of whether the App Server does so by providing anAppConfig.batchUrl. In this case,AppConfig.batchUrl!=AppManifest.batchUrl.