Streaming near real time data to IE clients in ASP.NET MVC3 ( COMET / HTTP Push / Reverse AJAX) RRS feed

  • Question

  • Hello  I need to gracefully degrade an application that will stream near-real-time data to an MVC 3 application to a non-Javascript mode.

    For this example suppose I have an MVC application like this:  (note the 's' because I plan to keep everything over SSL to prevent session cookie / firesheep attacks).

    This will cause a "ping" to be sent to Microsoft, and the response saved on disk/memory waiting for the client to ask for it.

    My question is how should the client get the data in the Internet Zone, and in the Restricted Sites Zone where Javascript is disabled?

    My first thought was to use Javascript/JSON/jQuery to query the controller or WCF for the latest information, and that would return a json response.  I believe that JSON GETs to an array of data exposes me to CSRF attacks so that may not be the best approach.

    For the non-Javascript approach I was thinking of having a META-REFRESH on the view and having that refresh the page every x interval.

    What are your thoughts?

    • Edited by ChrisLaMont Tuesday, March 29, 2011 9:39 PM
    Monday, February 7, 2011 4:20 AM


All replies

  • I think that this is the sort of application I'd be considering Silverlight or a forget browser and go windows with WPF/winforms.

    Depending on who's your users and why they might have Javascript disabled.  Apps which must have real time data but are open to the public are unusual and potentially kind of dangerous. 

    Tuesday, February 8, 2011 10:52 AM
  • PS

    You realise users can disable Meta Refresh in browsers?

    Tuesday, February 8, 2011 10:55 AM
  • What do you think of this solution, where I use silverlight to create a COMET style application?  Silverlight will be only used in the backend, and invisible to the client (width height of 0x0)


    Tuesday, March 29, 2011 9:38 PM
  • I don't really get why you wouldn't just display the data using Silverlight.

    Use MVVM and bind to an observable repository.  Run a thread every once in a while to update the repository.

    WPF and Silverlight are used by banks for near real time display of data. The binding makes it easy and xaml makes it look cool whilst separating concerns etc etc

    They could have been designed for this sort of requirement. 

    Wednesday, March 30, 2011 7:53 AM
  • I'd like my application to gracefully work on iPads, and only want to code the UI once.


    I think if I took this approach I could conditionally provide better COMET performance for my PC users, and degrade to a slower callback for non COMET use.

    Wednesday, March 30, 2011 5:53 PM
  • I can't imagine Silverlight is the answer here if you're worried they've got Javascript turned off. To qualify that, SL would be my choice given the streaming requirement but req. about not using Javascript scuppers it, in fact I'm not even sure the plug-in will fire correctly without javascript...should do but you may have to change the default launch code. But really, is non-javascript something you actually have to worry about? As for coding the UI once perhaps you should be looking at the networking features of HTML5...but then if they've got js need to firm up that req. I think. Personally I prefer apps for mobile devices not web pages, even if they're just compiled web pages behind the scenes.
    Saturday, April 2, 2011 7:38 AM
  • You don't absolutely need javascript for Silverlight.  All you need is an object tag, mate.

    I think Moonlight might well work on an iPad. 



    I would also suggest revisiting the no javascript requirement anyhow.

    • Marked as answer by ChrisLaMont Saturday, April 2, 2011 5:13 PM
    Saturday, April 2, 2011 10:08 AM
  • Yes, I see your point.  I think I'll create a Silverlight UI and a javascript one... perhaps based on Microsoft's research Reactive Extensions (RX). I *think* that will give me javascript only comet access. 
    Saturday, April 2, 2011 5:13 PM