From 48e209ce7dcbe1341e212db9d8927ba6aba3b4a7 Mon Sep 17 00:00:00 2001 From: Molly Jones Date: Mon, 24 Apr 2017 11:20:58 -0700 Subject: [PATCH 1/2] epi-2837 add shareConnection: true to examples, plus highlight in initialization summary of options --- src/managers/channel-manager.js | 5 +++-- src/managers/epicenter-channel-manager.js | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/managers/channel-manager.js b/src/managers/channel-manager.js index 4c5ff18f..100d934d 100644 --- a/src/managers/channel-manager.js +++ b/src/managers/channel-manager.js @@ -31,6 +31,7 @@ * * `options` The options object to configure the Channel Manager. Besides the common options listed here, see http://docs.cometd.org/reference/javascript.html for other supported options. * * `options.url` The Cometd endpoint URL. * * `options.websocketEnabled` Whether websocket support is active (boolean). + * * `options.shareConnection` Whether to share a websocket connection across multiple instances of the Channel Manager. In general, every channel that a project subscribes to should use the same connection, so set this to `true`. * * `options.channel` Other defaults to pass on to instances of the underlying Channel Service. See [Channel Service](../channel-service/) for details. * */ @@ -72,7 +73,7 @@ var ChannelManager = function (options) { ackEnabled: true, /** - * If false each instance of Channel will have a separate cometd connection to server, which could be noisy. Set to true to re-use the same connection across instances. + * If `false` each instance of Channel will have a separate cometd connection to server, which can be noisy. Set to `true` to re-use the same connection across instances. In general, every channel that a project subscribes to should use the same connection. * @type {boolean} */ shareConnection: false, @@ -171,7 +172,7 @@ ChannelManager.prototype = $.extend(ChannelManager.prototype, { * * **Example** * - * var cm = new F.manager.ChannelManager(); + * var cm = new F.manager.ChannelManager({shareConnection: true}); * var channel = cm.getChannel(); * * channel.subscribe('topic', callback); diff --git a/src/managers/epicenter-channel-manager.js b/src/managers/epicenter-channel-manager.js index fb377f5c..20af2cce 100644 --- a/src/managers/epicenter-channel-manager.js +++ b/src/managers/epicenter-channel-manager.js @@ -64,6 +64,7 @@ * * `options.userId` Epicenter user id used for authentication. Optional; `options.userName` is preferred. * * `options.token` Epicenter token used for authentication. (You can retrieve this using `authManager.getToken()` from the [Authorization Manager](../auth-manager/).) * * `options.allowAllChannels` If not included or if set to `false`, all channel paths are validated; if your project requires [Push Channel Authorization](../../../updating_your_settings/), you should use this option. If you want to allow other channel paths, set to `true`; this is not common. + * * `options.shareConnection` Whether to share a websocket connection across multiple instances of the [Channel Manager](../channel-manager/). In general, every channel that a project subscribes to should use the same connection, so set this to `true`. */ var ChannelManager = require('./channel-manager'); @@ -134,11 +135,12 @@ var EpicenterChannelManager = classFrom(ChannelManager, { * * **Example** * - * var cm = new F.manager.EpicenterChannelManager(); - * var channel = cm.getChannel('/group/acme/supply-chain-game/'); + * var cm = new F.manager.ChannelManager({shareConnection: true}); + * var channel1 = cm.getChannel('/group/acme/supply-chain-game/'); + * var channel2 = cm.getChannel('/data/acme/supply-chain-game/survey-responses/'); * - * channel.subscribe('topic', callback); - * channel.publish('topic', { myData: 100 }); + * channel1.subscribe('topic', callback); + * channel1.publish('topic', { myData: 100 }); * * **Parameters** * @param {Object|String} options (Optional) If string, assumed to be the base channel url. If object, assumed to be configuration options for the constructor. @@ -176,7 +178,7 @@ var EpicenterChannelManager = classFrom(ChannelManager, { * * **Example** * - * var cm = new F.manager.ChannelManager(); + * var cm = new F.manager.ChannelManager({shareConnection: true}); * var gc = cm.getGroupChannel(); * gc.subscribe('broadcasts', callback); * @@ -216,7 +218,7 @@ var EpicenterChannelManager = classFrom(ChannelManager, { * * **Example** * - * var cm = new F.manager.ChannelManager(); + * var cm = new F.manager.ChannelManager({shareConnection: true}); * var worldManager = new F.manager.WorldManager({ * account: 'acme-simulations', * project: 'supply-chain-game', @@ -262,7 +264,7 @@ var EpicenterChannelManager = classFrom(ChannelManager, { * * **Example** * - * var cm = new F.manager.ChannelManager(); + * var cm = new F.manager.ChannelManager({shareConnection: true}); * var worldManager = new F.manager.WorldManager({ * account: 'acme-simulations', * project: 'supply-chain-game', @@ -313,7 +315,7 @@ var EpicenterChannelManager = classFrom(ChannelManager, { * * **Example** * - * var cm = new F.manager.ChannelManager(); + * var cm = new F.manager.ChannelManager({shareConnection: true}); * var pc = cm.getPresenceChannel(); * pc.subscribe('', function (data) { * // 'data' is the entire message object to the channel; @@ -363,7 +365,7 @@ var EpicenterChannelManager = classFrom(ChannelManager, { * * **Example** * - * var cm = new F.manager.ChannelManager(); + * var cm = new F.manager.ChannelManager({shareConnection: true}); * var dc = cm.getDataChannel('survey-responses'); * dc.subscribe('', function(data, meta) { * console.log(data); From eaa8d0c36c04f08e1e9cec1e414f598618242d8f Mon Sep 17 00:00:00 2001 From: Molly Jones Date: Mon, 24 Apr 2017 11:22:07 -0700 Subject: [PATCH 2/2] epi-1797 (leftover): add stella to list of time-based modeling languages supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit didn’t seem like this needed its own pr. --- src/managers/scenario-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/managers/scenario-manager.js b/src/managers/scenario-manager.js index 3fbaeb2a..d5292bde 100644 --- a/src/managers/scenario-manager.js +++ b/src/managers/scenario-manager.js @@ -5,7 +5,7 @@ * * In other projects, often called "run comparison" or "scenario comparison" projects, end users set some initial decisions, then simulate the model to its end. Typically end users will do this several times, creating several runs, and compare the results. * -* The Scenario Manager makes it easy to create these "run comparison" projects. Each Scenario Manager allows you to compare the results of several runs. This is mostly useful for time-based models; by default, you can use the Scenario Manager with [Vensim](../../../model_code/vensim/), [Powersim](../../../model_code/powersim/), and [SimLang](../../../model_code/forio_simlang). (You can use the Scenario Manager with other languages as well, by using the Scenario Manager's [configuration options](#configuration-options) to change the `advanceOperation`.) +* The Scenario Manager makes it easy to create these "run comparison" projects. Each Scenario Manager allows you to compare the results of several runs. This is mostly useful for time-based models; by default, you can use the Scenario Manager with [Vensim](../../../model_code/vensim/), [Powersim](../../../model_code/powersim/), [SimLang](../../../model_code/forio_simlang), and [Stella](../../../model_code/stella/). (You can use the Scenario Manager with other languages as well, by using the Scenario Manager's [configuration options](#configuration-options) to change the `advanceOperation`.) * * The Scenario Manager can be thought of as a collection of [Run Managers](../run-manager/) with pre-configured [strategies](../strategies/). Just as the Run Manager provides use case -based abstractions and utilities for managing the [Run Service](../run-api-service/), the Scenario Manager does the same for the Run Manager. *