dist/f2.basic.js
function(appConfig, message, origin) {

		var obj, func;

		function parseFunction(parent, functionName) {
			var path = String(functionName).split('.');
			for (var i = 0; i < path.length; i++) {
				if (parent[path[i]] === undefined) {
					parent = undefined;
					break;
				}
				parent = parent[path[i]];
			}
			return parent;
		}

		function parseMessage(regEx, message, instanceId) {
			var o = F2.parse(message.replace(regEx, ''));

			// if obj.callbacks
			//   for each callback
			//     for each params
			//       if callback matches param
			//        replace param with _createRpcCallback(app.instanceId, callback)
			if (o.params && o.params.length && o.callbacks && o.callbacks.length) {
				jQuery.each(o.callbacks, function(i, c) {
					jQuery.each(o.params, function(i, p) {
						if (c == p) {
							o.params[i] = _createRpcCallback(instanceId, c);
						}
					});
				});
			}

			return o;
		}

		// handle UI Call
		if (_rUiCall.test(message)) {
			obj = parseMessage(_rUiCall, message, appConfig.instanceId);
			func = parseFunction(appConfig.ui, obj.functionName);
			// if we found the function, call it
			if (func !== undefined) {
				func.apply(appConfig.ui, obj.params);
			} else {
				F2.log('Unable to locate UI RPC function: ' + obj.functionName);
			}

		// handle RPC
		} else if (_rRpc.test(message)) {
			obj = parseMessage(_rRpc, message, appConfig.instanceId);
			func = parseFunction(window, obj.functionName);
			if (func !== undefined) {
				func.apply(func, obj.params);
			} else {
				F2.log('Unable to locate RPC function: ' + obj.functionName);
			}

		// handle RPC Callback
		} else if (_rRpcCallback.test(message)) {
			obj = parseMessage(_rRpcCallback, message, appConfig.instanceId);
			if (_callbacks[obj.functionName] !== undefined) {
				_callbacks[obj.functionName].apply(_callbacks[obj.functionName], obj.params);
				delete _callbacks[obj.functionName];
			}

		// handle Events
		} else if (_rEvents.test(message)) {
			obj = parseMessage(_rEvents, message, appConfig.instanceId);
			F2.Events._socketEmit.apply(F2.Events, obj);
		}
	}
function(appConfig, message, origin) {

		var obj, func;

		function parseFunction(parent, functionName) {
			var path = String(functionName).split('.');
			for (var i = 0; i < path.length; i++) {
				if (parent[path[i]] === undefined) {
					parent = undefined;
					break;
				}
				parent = parent[path[i]];
			}
			return parent;
		}

		function parseMessage(regEx, message, instanceId) {
			var o = F2.parse(message.replace(regEx, ''));

			// if obj.callbacks
			//   for each callback
			//     for each params
			//       if callback matches param
			//        replace param with _createRpcCallback(app.instanceId, callback)
			if (o.params && o.params.length && o.callbacks && o.callbacks.length) {
				jQuery.each(o.callbacks, function(i, c) {
					jQuery.each(o.params, function(i, p) {
						if (c == p) {
							o.params[i] = _createRpcCallback(instanceId, c);
						}
					});
				});
			}

			return o;
		}

		// handle UI Call
		if (_rUiCall.test(message)) {
			obj = parseMessage(_rUiCall, message, appConfig.instanceId);
			func = parseFunction(appConfig.ui, obj.functionName);
			// if we found the function, call it
			if (func !== undefined) {
				func.apply(appConfig.ui, obj.params);
			} else {
				F2.log('Unable to locate UI RPC function: ' + obj.functionName);
			}

		// handle RPC
		} else if (_rRpc.test(message)) {
			obj = parseMessage(_rRpc, message, appConfig.instanceId);
			func = parseFunction(window, obj.functionName);
			if (func !== undefined) {
				func.apply(func, obj.params);
			} else {
				F2.log('Unable to locate RPC function: ' + obj.functionName);
			}

		// handle RPC Callback
		} else if (_rRpcCallback.test(message)) {
			obj = parseMessage(_rRpcCallback, message, appConfig.instanceId);
			if (_callbacks[obj.functionName] !== undefined) {
				_callbacks[obj.functionName].apply(_callbacks[obj.functionName], obj.params);
				delete _callbacks[obj.functionName];
			}

		// handle Events
		} else if (_rEvents.test(message)) {
			obj = parseMessage(_rEvents, message, appConfig.instanceId);
			F2.Events._socketEmit.apply(F2.Events, obj);
		}
	}
function ( appConfig , message , origin ) { var obj , func ; function parseFunction ( parent , functionName ) { var path = String ( functionName ) . split ( '.' ) ; for ( var i = 0 ; i < path . length ; i ++ ) { if ( parent [ path [ i ] ] === undefined ) { parent = undefined ; break ; } parent = parent [ path [ i ] ] ; } return parent ; } function parseMessage ( regEx , message , instanceId ) { var o = F2 . parse ( message . replace ( regEx , '' ) ) ; // if obj.callbacks //   for each callback //     for each params //       if callback matches param //        replace param with _createRpcCallback(app.instanceId, callback) if ( o . params && o . params . length && o . callbacks && o . callbacks . length ) { jQuery . each ( o . callbacks , function ( i , c ) { jQuery . each ( o . params , function ( i , p ) { if ( c == p ) { o . params [ i ] = _createRpcCallback ( instanceId , c ) ; } } ) ; } ) ; } return o ; } // handle UI Call if ( _rUiCall . test ( message ) ) { obj = parseMessage ( _rUiCall , message , appConfig . instanceId ) ; func = parseFunction ( appConfig . ui , obj . functionName ) ; // if we found the function, call it if ( func !== undefined ) { func . apply ( appConfig . ui , obj . params ) ; } else { F2 . log ( 'Unable to locate UI RPC function: ' + obj . functionName ) ; } // handle RPC } else if ( _rRpc . test ( message ) ) { obj = parseMessage ( _rRpc , message , appConfig . instanceId ) ; func = parseFunction ( window , obj . functionName ) ; if ( func !== undefined ) { func . apply ( func , obj . params ) ; } else { F2 . log ( 'Unable to locate RPC function: ' + obj . functionName ) ; } // handle RPC Callback } else if ( _rRpcCallback . test ( message ) ) { obj = parseMessage ( _rRpcCallback , message , appConfig . instanceId ) ; if ( _callbacks [ obj . functionName ] !== undefined ) { _callbacks [ obj . functionName ] . apply ( _callbacks [ obj . functionName ] , obj . params ) ; delete _callbacks [ obj . functionName ] ; } // handle Events } else if ( _rEvents . test ( message ) ) { obj = parseMessage ( _rEvents , message , appConfig . instanceId ) ; F2 . Events . _socketEmit . apply ( F2 . Events , obj ) ; } }
Handles messages that come across the sockets
@method _onMessage
@private
@param {F2.AppConfig} appConfig The F2.AppConfig object
@param {string} message The socket message
@param {string} origin The originator
Handles messages that come across the sockets