bronson

0.5.0 • Public • Published

BRowser ONline SynchronizatiON Build status

Bronson is a real-time, cross-platform instant messaging framework for web, hybrid, and native mobile and desktop applications, built on top of Node.js and Socket.IO.

Functionality

Bronson shines in three dedicated areas:

  1. A wide array of supported platforms
  2. Isolated communication channels (rooms)
  3. Integration of existing backend APIs into the broadcasting platform.

More details below.

Supported platforms

Rooms

Clients can enter dedicated chat rooms to talk to other clients in that room. The visibility of broadcast messages is restricted to the room that the emitting client is in. Several rooms can be active at a time, allowing for parallel, isolated communication patterns.

Backend integration

Besides the traditional broadcast of static payload directly to peers, Bronson's broadcast messages can include a dynamic backend portion. In this scenario, the Bronson platform first performs a specified request to the backend API for the emitting client, then includes the backend's response into the message broadcasted to all clients.

Step 1 Clients load from the backend system and set up a persistent connection to the Bronson server.
Step 2 A client emits a broadcast message that includes a backend request to the Bronson server.
Step 3 The Bronson server forwards the request, including all request headers and cookies, to the backend system.
Step 4 The backend system responds to the Bronson server. No traffic to the clients happens at this stage.
Step 5 The Bronson server broadcasts the original broadcast message, including the response from the backend, to all clients.

This is useful, for example, to notify participants in a room about new data objects that have to be created on the server first. Bronson allows to do both things (creating objects in the backend and notifying all other clients) using only one call from the emitting device, thereby saving bandwidth and battery life on it.

How to use

Creating a Bronson server

Install the NPM module.

$ npm install bronson

Now, create a file called server.coffee, with this content:

Bronson = require 'bronson'
bronson = new Bronson "api.my-backend-host.com"
bronson.listen 3000

You can start this server like so:

$ coffee server.coffee

Chat server example.

More complete usage examples are given in the /examples directory.

The chat directory contains a fully functional chat application. The server portion, chat.coffee, creates a web server that serves an HTML file as well as a Bronson server for real-time broadcasting in only 12 lines of CoffeeScript. The client portion, chat.html, connects to the server, logs into a room, announces the user to the other participants, and provides facilities as well as UI for sending and receiving chat messages in only 10 lines of CoffeeScript.

Development

Fork away and send us a pull request!

Run the unit tests

$ npm test

You can alternatively run tests automatically with guard:

$ guard

Authors

Bronson is developed by Alex David and Kevin Goslar at Originate Inc., and is in production use for a variety of internal and external projects.

Readme

Keywords

none

Package Sidebar

Install

npm i bronson

Weekly Downloads

4

Version

0.5.0

License

none

Last publish

Collaborators

  • hallettj
  • originate-owner