Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top