How does Ember.js listen to events fired off from the server?

I am using node on the server side and incorporated passport twitter authentication on the server side. My question is: How do I signal the client when the twitter callback responded?

I have two api endpoints, one is the initial the twitter authentication, the second is for the callback.

app.get '/twitter', *calling twitter ...*

app.get '/twitter/callback', *callback from twitter ...*

So how can ember listen to the callback event from the server-side?

I don't think ember can listen to the callback event. However, within your callback you can update a value in an ember object.

For example, here's some code of an ember controller, and a callback

Ember controller

App.MyController = Em.ObjectController.extend({
  authenticated: false,
  updateAuthStatus: function() {
    Em.debug("We're auth status updated and is now: " + this.get('authenticated');
  }.observes('authenticated')
});

Callback

function(authenticated) {
  if (!authenticated) {
    alert("Authentication failed")
  } else {
    App.__container__.lookup("controller:my").set('authenticated', true);
  }
}

Better yet, have your passport authentication run from within an ember controller then you won't have to find the controller using the lookup function (and will probably also be a cleaner design).