With Crossbar.io apps are built from application components:
you write the components and Crossbar.io provides the glue.

Quick links:  Why should I care?   |   How it works   |   Show me some code!   |   Live Demos
Getting startedInstall Crossbar.io and start developing using an app template in your language.

Why should I care?

Crossbar.io is ideally suited for modern Web apps, integrates well with many single-page app (SPA) frameworks and libraries such as AngularJS, KnockoutJS, ExtJS or React and allows you to build reactive apps with awesome user experience.

Crossbar.io allows full-stack JavaScript development, but is also much more versatile because of its polyglot nature: apps can extend from HTML5 browser frontends and native mobile clients (such as Android and iOS) down to embedded devices (such as RaspberryPi and Arduino), served by backends composed across multiple servers and implemented in a mix of languages.

Crossbar.io is fully open-source, builds on open standards, does not lock you in, has a growing community of users and developers and a company behind that provides professional services and support.

App Components ... Your benefits:
1
Are loosely coupled
  • Extend your app incrementally without breaking things
  • Evolve different parts of your app independently
  • Tame complexity as your app grows
  • Agile development, as requirements change over time
2
Can run distributed across devices
  • Integrate components seamlessly using one technology
  • Scale your app by running components on different hosts
  • Pick the best host to run a particular set of functionality
3
Can be written in different languages
  • Choose the best language for a given part of your app
  • Make all team members productive, no matter what language
  • Use a single language for the full stack (e.g. JavaScript)
4
Can talk to each other without restrictions
  • Put functionality where you need it
  • Backends can call frontends when needed, not just vice versa
5
Communicate in real-time
  • Build reactive apps - from sensors to UIs
  • Build UIs with great user experience that users love to use
  • UIs always show current information - no refresh, no polling

How it works

Application components connect to Crossbar.io and can then talk to each other using two patterns:

Crossbar.io provides the glue between application components by making sure messages are directed and transmitted to the right components ("message routing").

Remote Procedure Calls

With the Remote Procedure Call pattern, any component can

  • Register a procedure that other components can call
  • Call procedures registered by other components

Crossbar.io routes calls to the component that registered the respective procedure and returns the result to the caller:

RPC pattern - registering a procedure with the Crossbar.io router PRC pattern - calling a remote procedure and receiving the result, routed via Crossbar.io

Remote Procedure Call is a 1-to-1 communication pattern which involves the Caller, the Router (Crossbar.io) and the Callee.

Publish & Subscribe

With the Publish & Subscribe pattern, any component can

  • Subscribe to receive events published from other components
  • Publish events which other subscribed components will receive

Crossbar.io routes event published to all components that have subscribed to receive events for the topic:

PubSub pattern - subscribing with Crossbar.io PubSub pattern - publishing to Crossbar.io, and Crossbar.io dispatching to subscribers

Publish & Subscribe is a 1-to-many communication pattern which involves the Publisher, the Router (Crossbar.io) and Subscribers.

Read more

Show me some code!

Here is what application components look like in some 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))
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";
   }
);
/?>

Live Demos

Crossbar.io is great for building advanced, distributed applications for Mobile, Web and Internet-of-Things (IoT). In particular if you need real-time. To give you a taste, here are a couple of live demos.


Reactive Manifesto: We are reactive banner