//ape var is a reference to APE instance
//myPipe var is a reference to a pipe object
//In this example this core will never be called as the event is only fired on the pipe
ape.addEvent('testEvent', function() {
console.log('Event received on core');
});
myPipe.addEvent('testEvent', function() {
console.log('Event received on pipe');
});
//Fire the event only on the pipe
myPipe.fireEvent('testEvent');

//ape var is a reference to APE instance
//myPipe var is a reference to a pipe object
//In this example this core will never be called as the event is only fired on the pipe
ape.addEvent('testEvent', function() {
console.log('Event received on core');
});
myPipe.addEvent('testEvent', function() {
console.log('Event received on pipe');
});
//Fire the event only on the pipe
myPipe.fireEvent('testEvent');

//ape var is a reference to APE instance
//myPipe var is a reference to a pipe object
//client var is a reference to a client instance
//Intercept event on pipe
myPipe.addEvent('testEvent', function() {
console.log('event received on pipe');
});
//Intercept event on core
ape.addEvent('testEvent', function() {
console.log('event received on core');
});
//Fire the event "testEvent" on the Pipe & Core
myPipe.fireGlobalEvent('testEvent', ['args1', 'args2']);

//ape var is a reference to APE instance
/Add an event when a new pipe is created
ape.addEvent('pipeCreate', function(type, pipe, options) {
//Test if the pipe is a "multi pipe" with name test1
if (type == 'multi' && pipe.name == 'test1') {
//Add an event when a message is received on the pipe test1
pipe.onCmd('send', function(data, pipe) {
console.log('Sending data on pipe pipe', pipe.name, ' message : ', data.msg);
});
}
//When a new pipe is created, send hello world
pipe.send('Hello world');
);
//Join channel test1 and test2
ape.join(['test1', 'test2']);

//client side code
/ape var is a reference to APE instance
//Add an event when a new pipe is created
ape.addEvent('pipeCreate', function(type, pipe, options) {
//Test if the pipe is a "multi pipe" with name test1
if (type == 'multi' && pipe.name == 'test1') {
//Add an event when a message is received on the pipe test1
pipe.onRaw('data', function(data, pipe) {
console.log('data received on pipe', pipe.name, ' message : ', data.msg);
});
}
//When a new pipe is created, send hello world
pipe.send('Hello world');
});
//Join channel test1 and test2
ape.join(['test1', 'test2']);