load

(since )



Load the APE client

Description


string load ( [object options] )

Load the APE client

Parameters


options
An object with ape default options
  • server - (string, optional) APE server URL
  • domain - (string, optional) Your domain, eg : yourdomain.com
  • identifier - (string) ; defaults to : ape identifier is used to differentiate two APE instance when you are using more than one application on your website and using Session.js
  • scripts - (array, optional) Javascript file to load
  • connectOptions - (object, optional) An object with connect arguments to send to APE server on connect. If given, as soon as APE Core is loaded, it connect to APE server with arguments given in connectOptions.

  • Examples


    //Initialize client
    client = new APE.Client();
    client.load();
     
    client.addEvent('load', function() {
        console.log('Your APE client is loaded');
        client.core.start({'name': 'apeUser'});
    });
     
    client.addEvent('start', function() {
        console.log('You are connected to APE server. Now you can takeover the world');
    };
     
     

    //Initialize client
    client = new APE.Client();
     
    //Load APE Core and connect to server
    client.load({
        'domain': 'yourdomain.com',
        'server': 'ape.yourdomain.com',
        'scripts': ['yourdomain.com/APE_JSF/Build/uncompressed/apeCore.js'],
        'connectOptions': {'name': 'anotherApeUser'}
    });
     
     
    client.addEvent('start', function() {
        console.log('You are connected to APE server. Now you can takeover the world');
    };
     
     

    User notes


    Nic
    Nic said:
    Well, shoutbox demo adds as parameters:
    'identifier':'chatdemo',
    'channel':'test'

    I don't know what identifier does, but channel leads to the user being connected to a new channel 'test' when he runs the start() method (alias 'connect')

    I wish this had been in the doc.
    12/10/10 22:08

    Post a note


    User notes may be edited or deleted, and usually a note is deleted because of the following reasons:
    • Bugs: Instead report a bug
    • Missing documentation: report that as a bug.
    • Support questions: See the community for available options.

    In other words, do not ask questions within the user notes.

    Note <b>,<u>,<i> HTML tags are allowed in the posts and the note formatting is preserved. URLs will be turned into clickable links, JavaScipt and C code blocks enclosed in the <source="javascript">JS Code</source> and <source="c">C Code</source> tags will be source highlighted automatically.