NodeJS client for the popular Rayo protocol

node-rayo is a node client for the popular Rayo protocol

To install and use node-rayo, use npm:

$ npm install node-rayo

node-rayo depends on the jab xmpp library which has some native dependencies for XML processing.

sudo apt-get install libexpat1 libexpat1-dev libicu-dev -y
sudo yum install expat expat-devel libicu libicu-devel -y

Download and install this file

curl -O
tar xzvf expat-2.0.1.tar.gz
cd expat-2.0.1
make check
sudo make install
cd ..
source /etc/profile

Include node-rayo:

var rayo = require('node-rayo');

To get started, create a connection with rayo.Connection():

conn = new rayo.Connection({
  host: '',
  jabberId: '',
  jabberPass: 'pass',
  debug: false,
  ping: true   

You can then use conn.create() to create a Rayo command:

dial = conn.create('dial', {
  to: '',
  from: ''

Once your command is created, you can listen to events specific to that command:

dial.on('ringing', function(cmd) {
  return"Call ringing...");
dial.on('answered', function(cmd) {
  return"Call answered!");

And then send that command (note dial, component and mixer commands require command.listen(; to wire up event handlers):

return conn.send(dial, function(cmd) {
  return dial.listen(;

Finally, connect!


You can view more complete examples in both CoffeeScript and JavaScript in the examples folder.