Real Time Meteor.js http.get


I am looking to develop a new application that relies on talking to an external service API.

For example, I want to create a real time Twitter feed that updates everytime there is a new tweet, I want to use Meteor as the framework but I'm not sure if it's possible to have Meteor display new tweets automatically without a page refresh.

I know I could do this with Node.js and but is it possible to do in solely Meteor?


11/2/2012 11:00:21 AM

There are basically two methods for retrieving data from an external source. Ajax or http request on the server. I recently tackled this, but had to use the second method.


Meteor.startup( function() { 'openSession', function( err, res ) {
        if( !err ) Session.set( 'data', res );


    openSession: function() {
        var fut = new Future(), url = '';

        // Do call here, return value with Future
        Meteor.http.get(url, function( err, res ){

        // Force method to wait on Future return
        return fut.wait();


As you can see, I had to use Future to make Meteor play along with the asynchronous http request. However, it's as simple as defining the method in your server side, then calling that on your client side.

11/3/2012 1:16:49 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow