Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epi 2837 #204

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/managers/channel-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
*/
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -171,7 +172,7 @@ ChannelManager.prototype = $.extend(ChannelManager.prototype, {
*
* **Example**
*
* var cm = new F.manager.ChannelManager();
* var cm = new F.manager.ChannelManager({shareConnection: true});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default example should always be the simplest - var cm = new F.manager.ChannelManager(). If it turns out that shareConnection indeed does work we'll just make that the default.

* var channel = cm.getChannel();
*
* channel.subscribe('topic', callback);
Expand Down
20 changes: 11 additions & 9 deletions src/managers/epicenter-channel-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
*
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/managers/scenario-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down