A Server for Realtime Apps: deepstream.io

2015-06-15 17:53:53 +0100 by Alex R. Young


Wolfram Hempel sent in an open source server called deepstream.io (GitHub: hoxton-one/deepstream.io, License: MIT, npm: deepstream.io). Deepstream is a Node server that allows clients to sync data, whether they're browsers or mobile applications. It has a caching layer, and supports event-based messaging and RPC.

If you install deepstream.io with npm, you can create a simple server like this:

var DeepstreamServer = require( 'deepstream.io' );
var server = new DeepstreamServer();

server.set('host', 'localhost');
server.set('port', 6020);


Then in the browser you can connect with var ds = deepstream('localhost:6020').login(). The ds object can be used to fetch and set data. The tutorial shows how to do this with a simple HTML form:

var record = ds.record.getRecord('someUser');
var input = document.querySelector('input');

input.onkeyup = function() {
  record.set('firstname', input.value ;

record.subscribe('firstname', function(value) {
  input.value = value;

The RPC calls allow functions to be bound to function names. One nice property of RPC in deepstream is if multiple clients are able to provide the same RPC, it will distribute requests evently between them.

The project is still new, but there are a good amount of tutorials already, including React and Angular examples.