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.6.8 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.6.7 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.6.6 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.6.5 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.6.4 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.6.3 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.6.2 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.6.1 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.6.0 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.5.1 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.5.0 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.32 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.31 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.30 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.29 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.28 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.27 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.26 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.25 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js
nutella_framework-0.4.24 example_framework_components/example_framework_web_interface/node_modules/nutella_lib/src/run_net.js