Sha256: 41ccdafe4bc94dfce1e2f998e021b4b8df44599dd347fe101b17de2add2a4c31

Contents?: true

Size: 1.68 KB

Versions: 54

Compression:

Stored size: 1.68 KB

Contents

/**
 * Run-level Network APIs for nutella
 */


var AbstractNet = require('./util/net');


/**
 * Run-level network APIs for nutella
 * @param main_nutella
 * @constructor
 */
var NetSubModule = function(main_nutella) {
    // Store a reference to the main module
    this.nutella = main_nutella;
    this.net = new AbstractNet(main_nutella);
};



/**
 * Subscribes to a channel or filter.
 *
 * @param channel
 * @param callback
 * @param done_callback
 */
NetSubModule.prototype.subscribe = function(channel, callback, done_callback) {
    this.net.subscribe_to(channel, callback, this.nutella.appId, this.nutella.runId, done_callback);
};



/**
 * Unsubscribes from a channel
 *
 * @param channel
 * @param done_callback
 */
NetSubModule.prototype.unsubscribe = function(channel, done_callback) {
    this.net.unsubscribe_from(channel, this.nutella.appId, this.nutella.runId, done_callback);
};



/**
 * Publishes a message to a channel
 *
 * @param channel
 * @param message
 */
NetSubModule.prototype.publish = function(channel, message) {
    this.net.publish_to(channel, message, this.nutella.appId, this.nutella.runId);
};



/**
 * Sends a request.
 *
 * @param channel
 * @param message
 * @param callback
 */
NetSubModule.prototype.request = function(channel, message, callback) {
    this.net.request_to(channel, message, callback, this.nutella.appId, this.nutella.runId);
};



/**
 * Handles requests.
 *
 * @param channel
 * @param callback
 * @param done_callback
 */
NetSubModule.prototype.handle_requests = function(channel, callback, done_callback) {
    this.net.handle_requests_on(channel, callback, this.nutella.appId, this.nutella.runId, done_callback);
};


module.exports = NetSubModule;

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
nutella_framework-0.4.23 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.22 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.21 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.20 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.19 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.18 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.17 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.16 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.13 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.12 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.11 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.10 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.9 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.8 framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js