Reactive Manifesto: We are reactive banner

Build more powerful applications in less time

Crossbar.io is a unified application router that enables application developers to create powerful systems from loosely coupled application components.

Application components can talk freely to each other, whether running locally or when distributed over different machines using the application messaging services provided by Crossbar.io.

Crossbar.io messaging services are based on WAMP (Web Application Messaging Protocol), an open protocol which provides easy to use remote procedure calls and real-time event notifications.

Crossbar.io is ideally suited for modern Web apps, and integrates well with many SPA frameworks and libraries such as AngularJS, KnockoutJS, ExtJS or React. It allows full-stack JavaScript development, but is much more versatile because of its polyglot nature: You can combine application components across supported languages. Using this, applications can extend from browser frontends and native mobile clients down to embedded devices, served by backends composed across multiple servers and implemented in a mix of languages.

diagram of crossbar.io router connecting frontend and backend application components in a variety of languages

Features

Unified Application Messaging

At its core, Crossbar.io provides a flexible and scalable communication infrastructure for application components to talk to each other. This communication infrastructure is based on Unified Routing and WAMP.

Application components involved are fully decoupled by Crossbar.io which dynamically routes calls and events between them.

Read more

Cross-language Integration

Crossbar.io supports application components written in different programming languages:

JavaScript (both Browser and NodeJS), Python, PHP, C++, Java (Android) and ObjectiveC (iOS), with more upcoming.

Application components run under their native run-time and can be automatically started and monitored by Crossbar.io.

Read more

Cross-Layer Integration

Crossbar.io features cross-layer integration: application components can be flexibly deployed across layers, and transparently talk to each other no matter in what layer the components reside.

E.g. you can call a remote procedure residing in a backend component from a frontend component running in the browser, but you can also call into code running inside the browser from a backend component!

Read more

Full-stack Services

Crossbar.io also includes a whole set of full-stack services, such as authentication and authorization, serving static Web files, HTTP long-poll fallback, HTTP push bridge, CGI scripts and hosting WSGI applications.

This will often make Crossbar.io all the infrastructure you need besides your database.

Read more

Scale-up & Scale-out Architecture

Crossbar.io has a multi-process architecture where a single node controller process spawns and monitors multiple worker processes. Worker process types include router, application component host and arbitrary guest processes.

The multi-process architecture enables scaling up on multi-core systems and supports secure and robust operation.

Read more

Show me some code!

Crossbar.io provides two communication patterns for application components to talk to each other

  • Remote Procedure Calls (RPC)
  • Publish & Subscribe(PubSub)

which involve four interactions

  • 1. Registering Procedures for remote calling (RPC)
  • 2. Calling Procedures remotely (RPC)
  • 3. Subscribing to Topics for receiving events (PubSub)
  • 4. Publishing Events to topics (PubSub)

Here is what application components look like across the different languages supported by Crossbar.io

// 1) SUBSCRIBE to a topic to reveive events
function onhello(args) {
   console.log("Got event:", args[0]);
}
session.subscribe('com.myapp.hello', onhello);

// 2) PUBLISH an event
session.publish('com.myapp.hello', ['Hello, world!']);

// 3) REGISTER a procedure for remote calling
function add2(args) {
   return args[0] + args[1];
}
session.register('com.myapp.add2', add2);

// 4) CALL a remote procedure
session.call('com.myapp.add2', [2, 3]).then(
   function (result) {
      console.log("Got result:", result);
   }
);
# 1) SUBSCRIBE to a topic to reveive events
def onhello(msg):
   print("Got event: {}".format(msg))
yield from session.subscribe(onhello, 'com.myapp.hello')

# 2) PUBLISH an event
session.publish('com.myapp.hello', 'Hello, world!')

# 3) REGISTER a procedure for remote calling
def add2(x, y):
   return x + y
session.register(add2, 'com.myapp.add2');

# 4) CALL a remote procedure
result = yield from session.call('com.myapp.add2', 2, 3)
print("Got result: {}".format(result))
// 1) SUBSCRIBE to a topic to reveive events
void onhello(const anyvec& args, const anymap& kwargs) {
   cout << "Got event: " << any_cast<string>(args[0]) << endl;   
}
session.subscribe("com.myapp.hello", &onhello);

// 2) PUBLISH an event
session.publish("com.myapp.hello", {string("Hello, world!")});

// 3) REGISTER a procedure for remote calling
any add2(const anyvec& args, const anymap& kwargs) {
   return any_cast<uint64_t>(args[0]) + any_cast<uint64_t>(args[1]);
}
session.provide("com.myapp.add2", &add2);

// 4) CALL a remote procedure
session.call("com.mathservice.add2", {2, 3}).then(
   [&](future<any> f) {
      cout << "Got result: " << any_cast<uint64_t> (f.get()) << endl;
   }
);
<?php
// 1) SUBSCRIBE to a topic to receive events
$onHello = function ($args) {
   echo "Got event: {$args[0]}\n";
};
$session->subscribe('com.myapp.hello', $onHello);

// 2) PUBLISH an event
$session->publish('com.example.oncounter', array('Hello, world!'));

// 3) REGISTER a procedure for remote calling
$add2 = function ($args) {
   return $args[0] + $args[1];
};
$session->register('com.myapp.add2', $add2);

// 4) CALL a remote procedure
$session->call('com.myapp.add2', array(2, 3))->then(
   function ($res) {
      echo "Got result: {$res}\n";
   }
);
/?>

Demos

We have some live demos which give some examples of the types of applications which can be realized using Crossbar.io

For historic reasons, these use PubSub functionality. We are working on demos using RPCs.

Try out a demo

Where to go from here