Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Muddling my way through real time

Remy Sharp
September 23, 2014

Muddling my way through real time

If your business deals with data on the web, then that data must be handled in real time, otherwise you're doing your user a disservice.

Remy Sharp

September 23, 2014
Tweet

More Decks by Remy Sharp

Other Decks in Programming

Transcript

  1. The server is the ultimate source of truth. We want

    the server to push the prices to the client.
  2. var http = require('http'); var server = http.createServer(function (req, res)

    { res.writeHead(200, { 'content-type': 'text/html' }); res.write('<script>console.log("start of the stream...")</script>'); var timer = setInterval(function () { if (res.connection.writable) { // keep sending a script with logging res.write('<script>console.log("and more...")</script>'); } else { // else connection has closed, and we can't write anymore // so clear this interval, and *attempt* to end the response clearInterval(timer); res.end(); } }, 2000); }); server.listen(8080); http://tick.rem.io
  3. Mobile over SSL or long polling Authorisation & sessions Scaling

    client connections: alias CNAME Scaling server: HAProxy, node-proxy, nginx + forwarding & redis backed lookup table Details
  4. $ npm install primus emit - named events metroplex -

    use redis to lookup servers & spark locations omega-supreme - allow broadcasting to server or sparks