index.js
/*
 * dispatches a message to the beacon process to be routed to the intended process
 * @param message {Object}: the message object to be sent
 */
dispatches a message to the beacon process to be routed to the intended process
@param message {Object}: the message object to be sent
dispatches a message to the beacon process to be routed to the intended process @param message { Object } : the message object to be sent
function send(message) {
     if((!message.to && message.to !== 0) || (!message.data && message.data !== 0)) {
         throw new Error("'to' or 'data' fields are missing from the message");
     }
     var enveloped_message = {
         type: 'klyng:msg',
         header: {
             from: process_rank,
             to: message.to
         },
         data : message.data
     };
     if(!!message.subject)
        enveloped_message.header.subject = message.subject;
     process.send(enveloped_message);
}
function send ( message ) { if ( ( ! message . to && message . to !== 0 ) || ( ! message . data && message . data !== 0 ) ) { throw new Error ( "'to' or 'data' fields are missing from the message" ) ; } var enveloped_message = { type : 'klyng:msg' , header : { from : process_rank , to : message . to } , data : message . data } ; if ( ! ! message . subject ) enveloped_message . header . subject = message . subject ; process . send ( enveloped_message ) ; }
dispatches a message to the beacon process to be routed to the intended process
 @param message {Object}: the message object to be sent
dispatches a message to the beacon process to be routed to the intended process @param message { Object } : the message object to be sent
/*
     * the message object contains the following keys
     * to {Number}: the rank of the process to recive that message (required)
     * data {Any JSON serializable data}: the data to be sent (required)
     * subject {String}: a mark for the message (optional)
     */