Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.
Pablo Tejada edited this page Aug 11, 2013 · 12 revisions

What is it?

ApePubSub is an alternative event driven Pub/Sub framework to the official APE_JSF for the APE Server. It is written in plain javascript and is great for beginners, good for those small/simpler projects. For a brief framework relation and comparison check APS relation to APE_JSF.

The client framework is based on @paraboul's next generation APE_JSF draft and the server framework is a compilation of custom commands, hooks and rewrites from the official server framework, the actual server binary does not require modification.

Overview

The whole client framework API is based on three simple objects: user, channel and the client itself. The client holds the channels and the channels the users, the rest are just reference to either one of this type of objects. All objects share most methods easing the learning curve of the API. Some methods defer in arguments depending on the direct parent object and some just stay the same. For example the pub() method in the client requires either the channel name or user/channel pubid in the first parameter and the message in the second while pub() in the user and a channel object only requires the message in the first parameter. For an in depth look check the API.

Features

The framework provides a fail proof session system which can easily be toggled on and off at any time, even after initialization. You can also publish and send custom events directly to users.

Modular built so you can globally add methods and properties to common objects such as user, channel and the client object via prototype. The objects for prototyping are as follows: APS.user, APS.channel, APS for the client.

A robust log() function is built-in the objects for debugging. For example if you call log() from a channel like channel.log("Error here!"); you will see the following output in your browser's console [APS][channel.name] Error here!. Other useful debugging info in the browser console are outgoing commands and incoming events. The outgoing commands are noted as <<<< NAME >>>> and incoming data/event are noted as >>>> NAME <<<< where NAME is the actual command or event. Also event triggered/fired are log into the console. For example a join event triggered on a channel music will show up like this on the browser console [APS][channel][music] {{{ join }}}. All this output can be turned off at anytime client.option.debug = false.

At the moment only two transports are supported, Websocket and Long Polling. Both transports are fully cross-domain compatible. Do note the Websocket protocol will only work with the APE server version 1.1.2-dev which you can build from source. Check how to build the server from source on APE Server setup.

Continue to Getting started