title: Multiple easyXDM in one page
body: <p>I am trying to use two easyXDM sockets on a single parent page without success. Both the sockets connect to the same remote domain but different endpoints. The parent page has two divs <code>false_app_div</code> and <code>dummy_app_div</code>.The following shows the code snippets -</p>
  
  <p>On the parent page I have two JS functions <code>activate_false_app()</code> and <code>activate_dummy_app()</code>.</p>
  
  <pre><code>window.loadScript = function(src, onload, onerror) {
     var head = document.getElementByTagName('head')[0];
     var script = document.createElement('script');
     script.type = 'text/javascript';
     script.src = src;
     if (script.readyState) {
        script.onreadystate = function() {
           var state = this.state;
           if (state === 'loaded' || state === 'complete') {
               script.onreadystate = null;
               onload();
           }
        };
     }
  };
  window.activate_false_app = function() {
     var exdm_url = 'http://localhost:8000/js/easyXDM/easyXDM.min.js';
     on_load_fn = function() {
        window.init_false_app_communication();
     };
     on_error_fn = function() {
        return false;
     };
     window.loadScript(exdm_url, on_load_fn, on_error_fn);
  };
  window.init_false_app_communication = function() {
     var false_app_socket = new easyXDM.Socket({
        remote : 'http://localhost:8000/false_app',
        swf : 'http://localhost:8000/js/easyXDM/easyXDM.swf',
        container : 'false_ap_div',
        onMessage : function(message, origin) {
           alert('false_app onMessage');
           alert(message);
        }
     });
  };
  window.activate_dummy_app = function() {
    var exdm_url = 'http://localhost:8000/js/easyXDM/easyXDM.min.js';
    on_load_fn = function() {
       window.init_dummy_app_communication();
    };
    on_error_fn = function() {
       return false;
    };
    window.loadScript(exdm_url, on_load_fn, on_error_fn);
  };
  window.init_dummy_app_communication = function() {
     var dummy_app_socket = new easyXDM.Socket({
         remote : 'http://localhost:8000/dummy_app',
         swf : 'http://localhost:8000/js/easyXDM/easyXDM.swf',
         container : 'dummy_app_div',
         onMessage : function(message, origin) {
             alert('dummy_app onMessage');
             alert(message);
         };
     });
  };
  </code></pre>
  
  <p>If in the parent page, I call either <code>activate_dummy_app()</code> or <code>activate_false_app()</code>, it works - that is both work completely fine in isolation. But if I call both, then only one of them works and I get an error on the JS console, that something is undefined (which I could not find).</p>
  
  <p>Also, I know that the problem has something to do with loading two easyXDMs because if I put <code>init_dummy_app_communication</code> in the <code>on_load_fn</code> of <code>activate_false_app()</code> (in addition to <code>init_false_app_communication</code> already present), then both works.</p>
  
  <p>However, I cannot be sure that easyXDM is already loaded, so both <code>activate_false_app</code> and <code>activate_dummy_app</code> has to load easyXDM, so that they work in isolation as well as together. I tried working with <code>noConflict</code> function, but the documentation there is poor and ended up with nothing concrete there. </p>
  
  <p>Has someone faced a similar problem or knows what I am missing here? </p>