{"id":16758184,"url":"https://github.com/foo123/rt","last_synced_at":"2025-07-13T04:31:20.485Z","repository":{"id":54401540,"uuid":"58287047","full_name":"foo123/RT","owner":"foo123","description":"RT.js: unified client-side real-time communication for JavaScript using XHR polling / BOSH / WebSockets / WebRTC","archived":false,"fork":false,"pushed_at":"2022-08-07T16:54:51.000Z","size":7721,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-20T09:15:46.654Z","etag":null,"topics":["bosh","polling","real-time","websocket"],"latest_commit_sha":null,"homepage":"https://foo123.github.io/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foo123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-07T22:32:06.000Z","updated_at":"2024-07-20T02:12:05.000Z","dependencies_parsed_at":"2022-08-13T14:31:13.338Z","dependency_job_id":null,"html_url":"https://github.com/foo123/RT","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FRT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo123","download_url":"https://codeload.github.com/foo123/RT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225855966,"owners_count":17534966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bosh","polling","real-time","websocket"],"created_at":"2024-10-13T04:04:24.572Z","updated_at":"2024-11-22T07:06:53.765Z","avatar_url":"https://github.com/foo123.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RT\n\n![RT](/rt.jpg)\n\n\nUnified Node/XPCOM/JS client-side real-time communication with underlying implementations for:\n\n* [(XHR)](https://en.wikipedia.org/wiki/XMLHttpRequest) [Polling](https://en.wikipedia.org/wiki/Polling_%28computer_science%29)\n* [BOSH](https://en.wikipedia.org/wiki/BOSH)\n* [WebSocket](https://en.wikipedia.org/wiki/WebSocket) (native/flash/Node/XPCOM support)\n* [WebRTC](https://en.wikipedia.org/wiki/WebRTC) (TODO)\n\n\n**see also:**\n\n* [ModelView](https://github.com/foo123/modelview.js) a simple, fast, powerful and flexible MVVM framework for JavaScript\n* [Contemplate](https://github.com/foo123/Contemplate) a fast and versatile isomorphic template engine for PHP, JavaScript, Python\n* [HtmlWidget](https://github.com/foo123/HtmlWidget) html widgets, made as simple as possible, both client and server, both desktop and mobile, can be used as (template) plugins and/or standalone for PHP, JavaScript, Python (can be used as [plugins for Contemplate](https://github.com/foo123/Contemplate/blob/master/src/js/plugins/plugins.txt))\n* [Paginator](https://github.com/foo123/Paginator)  simple and flexible pagination controls generator for PHP, JavaScript, Python\n* [ColorPicker](https://github.com/foo123/ColorPicker) a fully-featured and versatile color picker widget\n* [Pikadaytime](https://github.com/foo123/Pikadaytime) a refreshing JavaScript Datetimepicker that is ightweight, with no dependencies\n* [Timer](https://github.com/foo123/Timer) count down/count up JavaScript widget\n* [InfoPopup](https://github.com/foo123/InfoPopup) a simple JavaScript class to show info popups easily for various items and events (Desktop and Mobile)\n* [Popr2](https://github.com/foo123/Popr2) a small and simple popup menu library\n* [area-select.js](https://github.com/foo123/area-select.js) a simple JavaScript class to select rectangular regions in DOM elements (image, canvas, video, etc..)\n* [area-sortable.js](https://github.com/foo123/area-sortable.js) simple and light-weight JavaScript class for handling smooth drag-and-drop sortable items of an area (Desktop and Mobile)\n* [css-color](https://github.com/foo123/css-color) simple class for manipulating color values and color formats for css, svg, canvas/image\n* [jquery-plugins](https://github.com/foo123/jquery-plugins) a collection of custom jQuery plugins\n* [jquery-ui-widgets](https://github.com/foo123/jquery-ui-widgets) a collection of custom, simple, useful jQueryUI Widgets\n* [touchTouch](https://github.com/foo123/touchTouch) a variation of touchTouch jQuery Optimized Mobile Gallery in pure vanilla JavaScript\n* [Imagik](https://github.com/foo123/Imagik) fully-featured, fully-customisable and extendable Responsive CSS3 Slideshow\n* [Carousel3](https://github.com/foo123/Carousel3) HTML5 Photo Carousel using Three.js\n* [Rubik3](https://github.com/foo123/Rubik3) intuitive 3D Rubik Cube with Three.js\n* [MOD3](https://github.com/foo123/MOD3) JavaScript port of AS3DMod ActionScript 3D Modifier Library\n* [RT](https://github.com/foo123/RT) unified client-side real-time communication for JavaScript using XHR polling / BOSH / WebSockets / WebRTC\n* [AjaxListener.js](https://github.com/foo123/AjaxListener.js): Listen to any AJAX event on page with JavaScript, even by other scripts\n* [asynchronous.js](https://github.com/foo123/asynchronous.js) simple manager for asynchronous, linear, parallel, sequential and interleaved tasks for JavaScript\n* [classy.js](https://github.com/foo123/classy.js) Object-Oriented mini-framework for JavaScript\n\n\n\n**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).\n\n\n**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**)\n\n\n* `RT` is also a `XPCOM JavaScript Component` (Firefox) (e.g to be used in firefox browser addons/plugins)\n\n\n\n**Example API**\n\n![RT Simple Chat](/rt_chat.png)\n\n\n```javascript\n// from real-time chat example\n\n//e.g in node\n/*\nvar RT = require('./RT.js');\nrequire('./RT.Poll.js');\nrequire('./RT.BOSH.js');\nrequire('./RT.WebSocket.js');\n*/\n// in browser\n/*\n\u003cscript type=\"text/javascript\" src=\"./RT.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"./RT.Poll.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"./RT.BOSH.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"./RT.WebSocket.js\"\u003e\u003c/script\u003e\n*/\n\nvar rt_impl = 'ws' /* 'ws'=WebSocket, 'bosh'=BOSH, 'poll'=POll */;\n\nvar rt_chat = RT({\n        use: rt_impl,\n        endpoint: 'ws' === rt_impl ? 'ws://127.0.0.1:1111' : ('bosh' === rt_impl ? './relay.php?bosh=1' : './relay.php?poll=1')\n    })\n    .on('receive', function( evt ){\n        if ( !evt.data ) return;\n        var m = RT.Util.Json.decode( evt.data );\n        output.innerHTML += '\u003cdiv class=\"entry'+(m.user===user?' own':'')+'\"\u003e\\\n        \u003cspan class=\"user\"\u003e' + userify( m.user ) + '\u003c/span\u003e\\\n        \u003cspan class=\"message\"\u003e' + textify( m.message ) + '\u003c/span\u003e\\\n        \u003c/div\u003e';\n    })\n    /*.one('open', function( ){\n        alert('OPENED');\n    })*/\n    .on('close', function( ){\n        alert('CLOSED!');\n    })\n    .on('error', function( evt ){\n        alert('ERROR: '+evt.data);\n    })\n    .init( )\n;\n\nfunction send( event )\n{\n    if ( RT.Client.OPENED !== rt_chat.status ) return;\n    if ( event \u0026\u0026 (!key_is(event, 13) || event.shiftKey) ) return;\n    var msg = RT.Util.String.trim( input.value||'' );\n    input.value = '';\n    if ( !msg.length ) return;\n    rt_chat.send(RT.Util.Json.encode({\n        'user': user,\n        'message': msg\n    }));\n}\n```\n\n\n[Etymology of *\"real\"*](https://en.wiktionary.org/wiki/real)\n compare to [names/symbols of the sun](http://www.behindthename.com/names/meaning/sun) (e.g [Ra](https://en.wikipedia.org/wiki/Ra), [Surya](https://en.wikipedia.org/wiki/Surya), [Sol](https://en.wikipedia.org/wiki/Sol_%28mythology%29), [Helios](https://en.wikipedia.org/wiki/Helios))\n compare to [rajah](https://en.wiktionary.org/wiki/rajah#English), [pharaoh](https://en.wiktionary.org/wiki/pharaoh), [regal](https://en.wiktionary.org/wiki/regal), [royal](https://en.wiktionary.org/wiki/royal), [rex](https://en.wiktionary.org/wiki/rex#Latin), [tyrannus](https://en.wiktionary.org/wiki/%CF%84%CF%8D%CF%81%CE%B1%CE%BD%CE%BD%CE%BF%CF%82#Ancient_Greek) (e.g *\"Oedipus Tyrannus\"*, i.e *\"Oedipus Rex\"*)\n\n\n\n[Etymology of *\"hour\"* (as in *\"time\"*, *\"ώρα\"*)](https://en.wiktionary.org/wiki/hour) compare to [Horus](https://en.wikipedia.org/wiki/Horus), [Helios](https://en.wikipedia.org/wiki/Helios)\ncompare to [*\"ωραίο\"*, oraío, (original: \"timely\",\"in time\", metaphor for \"beatiful\")](https://en.wiktionary.org/wiki/%CF%89%CF%81%CE%B1%CE%AF%CE%BF%CF%82#Greek)\n\n\n\nReally beatiful, isnt it? :))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Frt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo123%2Frt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Frt/lists"}