SummaryJavaScript framework designed primarily for asynchronous push communication with custom servers (comet). Python back-end examples included, as well as a basic JavaScript effects library, and ActionScript source for handling the active connections.
The Push Communication framework uses
... [More]
Flash's XMLSocket object as a middle layer. Sample back-end servers included are written in Twisted. Twisted is an event-driven networking engine written in Python.
Real World Usage
Webpage Description Photos.CX Photos Spy Warning! Live website may contain 18+ material. Uses photos.py and photos_sender.py along with the Effects and Push framework to notify users of new public uploads. Features real-time chat room used to discuss new uploads with other users. Custom front-end code.
ExamplesUsing the Push Communication Framework
var onData = function(data) {
alert('Server said:' + data);
}
var onClose = function() {
alert('Goodbye.');
}
// initialize connection with server running on localhost port 3002 (included)
var fs = new AONIC.api.PushCommunication('localhost', '3002', 'flashSock');
fs.addCallback('onData', onData).addCallback('onClose', onClose);
fs.send('John Doe.'); // -> alert('Server said: Welcome John Doe!');
Using the Effects Framework
new AONIC.api.Effects('photoBox', 0, 300, 'height', {duration:300}).slide();
Quick and Dirty Chat Room using chatd.py and Push FrameworkStart the server: python chatd.py
Webpage:
var fs;
window.onload = function() {
// safari 3.0 needs a little more time
setTimeout((function() {
fs = new AONIC.api.PushCommunication('localhost', '3002', 'flashSock');
fs.addLine = function(line) {
if(line.length == 0) return;
AONIC.$('chat').value += '\n'+line;
AONIC.$('chat').scrollTop = AONIC.$('chat').scrollHeight;
};
fs.sendMessage = function(input) {
var msg = input.value;
if(msg.length == 0) return;
input.value = '';
this.send(msg);
if(!this.username) {
this.username = msg;
return;
}
this.addLine(this.username + '> ' + msg);
};
fs.addCallback('onData', fs.addLine);
}), 100);
};
Enter a username in the input. [Less]