var ape = new APE.Core({
'server': 'ape.yourdomain.com',
'pollTime': 35000, //if you set pollTime to 35sec you need to set it on the server side to 55sec
'identifier': 'myApplicationIdentifier',
'transport': 2,
'frequency': 3
});
ape.start();
client.addEvent('load', function() {
console.log(ape.user.pubid); //Show pubid of current user
console.log(ape.user.properties); //Show properties of current user
}

Note: this is automatically done and can be configured by the pollTime option parameter.

File:

<./src/Ape_Jsf/Source/Core/Core.js>

Example

var ape = new APE.Core({
'pollTime': 35000, //if you set pollTime to 35sec you need to set it on the server side to 55sec
'identifier': 'myApplicationIdentifier',
});
ape.start();
// obsessive check
setInterval(function(){
ape.check();
}, 1000);

//ape var is a reference to APE instance
//Error 004 is fired when you sent a bad sessid (this can happen if the client experience some connection issue longer than 45sec)
ape.onError('004', function() {
ape.clearSession();
ape.initialize(ape.options); //Reinitialize APE class
});

//ape var is a reference to APE instance
//Get a pipe
var myPipe = ape.getPipe('a852c20b3e5c9889c16fe4ac88abe98f');
//Send a message on the pipe
myPipe.send('Hello world');

//ape var is a reference to APE instance
//getPipe on Multi Pipe
//ape var is a reference to APE instance
ape.join('testChannel');
//This sample is just here to show you how to intercept pipe pubid in pipeCreate event
ape.addEvent('multiPipeCreate', function(type, pipe, options) {
//Get the pipe object
var myPubid = ape.getPipe(pipe.getPubid());
//Send a message on the pipe
myPipe.send('Hello world');
});

//ape var is a reference to APE instance
//ape var is a reference to APE instance
ape.join('testChannel');
ape.addEvent('userJoin', function(user, pipe) {
//For performance purpose, user are not pipe in APE JSF. If you want to have a pipe from an user, use getPipe.
//Transform all user into a pipe object
var pipe = ape.getPipe(user.pubid);
//Send 'Hello world' to the user
pipe.send('Hello world');
});

//ape var is a reference to APE instance
//If you use APE with libape-chat you need to send your nickname in the CONNECT request
ape.start('myNickname'); //Send CONNECT command with a nickname to APE and tries to join the optional channel

{string} options.identifierOptionaldefaults 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

{Array} options.scriptsOptionalJavascript files to load

{string} options.channelOptionalInitial channel to connect to upon loading

{object} options.connectOptionsOptionalAn 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.