Skip to content

Latest commit

 

History

History
120 lines (88 loc) · 6.34 KB

README.md

File metadata and controls

120 lines (88 loc) · 6.34 KB

RT

RT

Unified Node/XPCOM/JS client-side real-time communication with underlying implementations for:

see also:

  • Contemplate a light-weight template engine for Node/XPCOM/JS, PHP, Python, ActionScript
  • HtmlWidget html widgets used as (template) plugins and/or standalone for PHP, Node/XPCOM/JS, Python both client and server-side
  • Tao A simple, tiny, isomorphic, precise and fast template engine for handling both string and live dom based templates
  • ModelView a light-weight and flexible MVVM framework for JavaScript/HTML5
  • ModelView MVC jQueryUI Widgets plug-n-play, state-full, full-MVC widgets for jQueryUI using modelview.js (e.g calendars, datepickers, colorpickers, tables/grids, etc..) (in progress)
  • Importer simple class & dependency manager and loader for PHP, Node/XPCOM/JS, Python
  • PublishSubscribe a simple and flexible publish-subscribe pattern implementation for Node/XPCOM/JS, PHP, Python, ActionScript
  • Dromeo a flexible, agnostic router for Node/XPCOM/JS, PHP, Python, ActionScript
  • Dialect a simple cross-platform SQL construction for PHP, Python, Node/XPCOM/JS, ActionScript
  • Xpresion a simple and flexible eXpression parser engine (with custom functions and variables support) for PHP, Python, Node/XPCOM/JS, ActionScript
  • GrammarTemplate versatile and intuitive grammar-based templating for PHP, Python, Node/XPCOM/JS, ActionScript
  • GrammarPattern versatile grammar-based pattern-matching for Node/XPCOM/JS (IN PROGRESS)
  • Regex Analyzer/Composer Regular Expression Analyzer and Composer for Node/XPCOM/JS, PHP, Python, ActionScript
  • DateX eXtended & localised Date parsing, diffing, formatting and validation for Node/XPCOM/JS, Python, PHP, ActionScript
  • Abacus a fast combinatorics and computation library for Node/JS, PHP, Python
  • Asynchronous a simple manager for async, linearised, parallelised, interleaved and sequential tasks for JavaScript

Note1 RT is not only a simple framework around real-time layer implementations, it is also a small protocol additional to an implementation, which enables optimum performance, e.g by multiplexing multiple requests transparently (where applicable).

Note2 some BOSH implementations (especialy javascript implementations) are actually XMPP-BOSH implementations (meaning they implement XMPP over BOSH, i.e using BOSH technique and protocol for XMPP). This is just the BOSH, without the XMPP part (which of course can be implemented using the BOSH method of RT or other method e.g websocket, but still it is an autonomous technique in itself)

  • RT is also a XPCOM JavaScript Component (Firefox) (e.g to be used in firefox browser addons/plugins)

Example API

RT Simple Chat

// from real-time chat example

//e.g in node
/*
var RT = require('./RT.js');
require('./RT.Poll.js');
require('./RT.BOSH.js');
require('./RT.WebSocket.js');
*/
// in browser
/*
<script type="text/javascript" src="./RT.js"></script>
<script type="text/javascript" src="./RT.Poll.js"></script>
<script type="text/javascript" src="./RT.BOSH.js"></script>
<script type="text/javascript" src="./RT.WebSocket.js"></script>
*/

var rt_impl = 'ws' /* 'ws'=WebSocket, 'bosh'=BOSH, 'poll'=POll */;

var rt_chat = RT({
        use: rt_impl,
        endpoint: 'ws' === rt_impl ? 'ws://127.0.0.1:1111' : ('bosh' === rt_impl ? './relay.php?bosh=1' : './relay.php?poll=1')
    })
    .on('receive', function( evt ){
        if ( !evt.data ) return;
        var m = RT.Util.Json.decode( evt.data );
        output.innerHTML += '<div class="entry'+(m.user===user?' own':'')+'">\
        <span class="user">' + userify( m.user ) + '</span>\
        <span class="message">' + textify( m.message ) + '</span>\
        </div>';
    })
    /*.one('open', function( ){
        alert('OPENED');
    })*/
    .on('close', function( ){
        alert('CLOSED!');
    })
    .on('error', function( evt ){
        alert('ERROR: '+evt.data);
    })
    .init( )
;

function send( event )
{
    if ( RT.Client.OPENED !== rt_chat.status ) return;
    if ( event && (!key_is(event, 13) || event.shiftKey) ) return;
    var msg = RT.Util.String.trim( input.value||'' );
    input.value = '';
    if ( !msg.length ) return;
    rt_chat.send(RT.Util.Json.encode({
        'user': user,
        'message': msg
    }));
}

Etymology of "real" compare to names/symbols of the sun (e.g Ra, Surya, Sol, Helios) compare to rajah, pharaoh, regal, royal, rex, tyrannus (e.g "Oedipus Tyrannus", i.e "Oedipus Rex")

Etymology of "hour" (as in "time", "ώρα") compare to Horus, Helios compare to "ωραίο", oraío, (original: "timely","in time", metaphor for "beatiful")

Really beatiful, isnt it? :))