Thu 3 Sep 2009
About
Kamaloka-js is an implementation of the AMQP messaging protocol in native JavaScript. It is setup to be used with Orbited but can be used with any library which produce TCPSockets in the browser similar to Orbited. Kamaloka bindings are generated from qpid XML protocol description files.
Status
You can currently :
- negotiate a connection with an AMQP 0.10 server (support for adding and loading different versions is there if a new spec comes along)
- issue any commands and controls described by the spec (whether or not the server is doing anything with them has not been verified yet but, it doesn’t drop your connection)
Some limitation:
- for now we don’t handle multiple frames or channels though this feature is planned down the road
- we don’t do automatic version negotiation, but then we only implement one version
Why Kamaloka
amqp-js was taken by a project that implements the 0-8 AMQP protocol through Flash. If some day the qpid project wanted to use kamaloka-js as the definitive AMQP javascript implementation I would be happy to rename it qpid-js, but I am not that presumptuous. The thought process for the name went like this:
qpid->cupid->kama->kamaloka
Since Kama is in the same lexicon as Moksha (another project I work on which will be using the bindings) I thought it fit nice. It also allows me to name the QMF bindings kamarupa-js since according to the wikipedia Kama page “Kama-rupa is a subtle body or aura composed of desire, while Kama-loka is the realm this inhabits.” So QMF inhabits AMQP
Playground
Included in the distribution is a playground for testing the bindings in interesting AMQP configurations on your local machine. As pieces get implemented the playground will expand to show off different ways of using the bindings. Bellow is an example of using the current low level bindings based off the python subscribe example:
<script type="text/JavaScript">
Orbited.settings.port = 9000;
amqp_broker_port = 7000;
amqp_conn = amqp.Connection({host: 'localhost',
port: amqp_broker_port,
send_hook: function(msg) { // for debugging
append_msg('SENT', msg);
},
recive_hook: function(data) { // for debugging
append_msg('RECV', data);
}
});
amqp_conn.start();
// You should have your server generate a UUID since browser methods
// are unreliable at best
session = amqp_conn.create_session('not_a_great_id' + (new Date().getTime() + Math.random()));
var fedoraproject = "org.fedoraproject-" + session.name;
session.Queue('declare', {queue:fedoraproject, exclusive:true});
session.Exchange('bind', {exchange: "amq.topic",
queue: fedoraproject,
binding_key: "org.fedoraproject.#"});
// Bind each queue to the control queue so we know when to stop
session.Exchange('bind', {exchange:"amq.topic",
queue: fedoraproject,
binding_key:"control"});
</script>
Give me the code
- Project homepage & trac: https://fedorahosted.org/kamaloka-js/
- Mailing list: https://fedorahosted.org/mailman/listinfo/kamaloka-js-devel
- git: git clone http://git.fedorahosted.org/git/kamaloka-js.git

September 4th, 2009 at 2:04 am
[...] this post in: ar de es fr it ja ko pt ru zh-CN [...]
September 4th, 2009 at 3:44 am
[...] this page was mentioned by PostRank – Linux (@pr_linux), Mathiew (@mathieuravaux), Jim Pick (@jimpick), bear (@bear), Dion Almaer (@dalmaer) and others. [...]
September 8th, 2009 at 7:28 am
[...] you like to talk messaging directly from the browser? Kamaloka is a new library that speaks AMQP. You can easily tie to Orbited but also, in theory, any other [...]
September 8th, 2009 at 11:07 am
That’s really cool. Good to know about Orbited too!
September 8th, 2009 at 9:56 pm
Seems like you are a Buddhist and happy to say that me too.
Lahiru
September 10th, 2009 at 8:29 pm
[...] you like to talk messaging directly from the browser? Kamaloka is a new library that speaks AMQP. You can easily tie to Orbited but also, in theory, any other [...]