0

The application has a widget where the list of items keep changing based on some events on the server side. The server has to push these changes to the browser.

The application uses emberjs as javascript mvc framework and I have managed to implement the basic update of collection following this stock ticker example. ttp://www.xeqtit.com/blog/2012/04/creating-a-stock-ticker-table-using-ember-js.

I am trying to replace the following stub/mock calls with actual REST calls to the server.

       setInterval(function() {
           Quotes.quotesController.processChange({
                  "code": "AAPL",
                   "value": (119*Math.random()).toFixed(2),
                   "bid": (120*Math.random()).toFixed(2),
                   "offer": (118*Math.random()).toFixed(2)
         });
      }, 3*1000);

replacing with,

       var source = new EventSource('data/quotes.json');

       source.onmessage = function(event){
            var data = event.data;
            Quotes.quotesController.processChange(event.data);
          };

-Should I be writing a servlets based on asynch support in Servlet 3.0 spec? -Would it be ideal to integrate spring mvc on the server side along with client side mvc framework like emberjs ? - Is it possible to achieve server sent events/asynch call back support with just jersey/RESTlet library on a jetty server ??

This is a java ee application and the choice of server/frameworks are yet to be made. I am new to emberjs,spring mvc and comet applications.

Yeshvanthni
  • 207
  • 2
  • 15

1 Answers1

1

What about using ember-data to store your quotes, and feed them through a WebSocket.

You say choices are not made: Did you consider using RoR as the server-side framework? As of today, it is the most ember-data friendly implementation (along with active-model-serializers). Writing the server side with this stack is just a piece of cake.

Mike Aski
  • 9,180
  • 4
  • 46
  • 63
  • Even in a JEE environment, you can easily deploy a RoR app (there are several solution according to your situation: wrap it with Warbler, e.g, or event use GF). At worst, did you heard about Play! ? – Mike Aski Jun 06 '12 at 06:33
  • The decision to use Java EE is at the organizational level and we don't have much flexibility in that. Scala/lift was not chosen for the same reason inspite of the comet support. Have been checking Play framework – Yeshvanthni Jun 07 '12 at 15:47
  • am also considering atmosphere framework + spring mvc for comet support.Any opinions ? – Yeshvanthni Jun 07 '12 at 15:48
  • don't know atmosphere, sorry... :-( – Mike Aski Jun 07 '12 at 15:57