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

Building Real-Time Applications in Ember.js

Building Real-Time Applications in Ember.js

Steve Kinney

March 04, 2015
Tweet

More Decks by Steve Kinney

Other Decks in Technology

Transcript

  1. It's also a story about integrating all sorts of browser

    functionality and third-party code into our applications.
  2. Now, that we know everything there is to know about

    WebSockets, let’s get to implementing them.
  3. var WebSocketServer = require('ws').Server; var socket = new WebSocketServer({ port:

    8080 }); socket.on('connection', function(connection) { connection.on('message', function(message) { socket.broadcast(message); }); }); socket.broadcast = function(data) { this.clients.forEach(function (client) { client.send(data); }); };
  4. A Traditional Example var socket = io(); $('form').submit(function(){ socket.emit('chat message',

    $('#m').val()); $('#m').val(''); return false; }); socket.on('chat message', function(msg){ $('#messages').append($('<li>').text(msg)); });