9

Right now, I'm choosing technologies for a simple crossplatform mobile application. Target systems are basically iOS, Windows Phone 7.5 and Windows 8. In the first step it's going to be a local wireless LAN application.

There are existing servers (using .net / WCF) that have all the data I want to display. The app will be polling every few seconds and give a live view on the data. I won't be accessing the data server directly but have to create my own app-server in between.

For the client I chose the HTML5, CSS, JavaScript (JQuery) approach to make it run in any modern browser. So I'll have to communicate via http.

My question is which technologie to use for the server side of my app. I have to receive http requests, get data (at best via WCF) from another server and send it to the client as xml or html. (I am not quite sure whether server or client has to convert xml data into html)

Searching the web I figured out two possible approaches:

  • ASP.net
  • Building my own simple http server using WCF

Looking at some ASP.net documentation and examples I got the impression that it just works the way I know from PHP etc... (Client sends request, server runs a script/programm, server sends response, programm terminates) I cannot keep objects in memory and run code independent of client requests. Or at least it's not designed to work like that. Is that correct?

That would force me to build my own very simple server that can answer a few specific http requests.

So my questions are:

  • Are my assumptions about ASP.net correct? Or did I get something wrong?
  • Would be an own http server the way to go?
  • Can you recommend any other approaches (within the Microsoft / .net world)?

Thanks in advance...

4
  • 1
    For speed, ease of testing and ease of integration I think you can't go far wrong with MVC. It's also excellent for developing web services Mar 8, 2012 at 9:48
  • Your views about server side technology, although correct, are very narrow. There are cohorts of server side technologies like PHP, Java, Python etc. I have never been a fan of ASP .Net for the simple reason of licensing. I don't want to confuse you but you should do some more research before finalizing your server side technology.
    – Juzer Ali
    Mar 8, 2012 at 10:20
  • I'd personally go with Node.js or Ruby EventMachine and create my own web server (there are also rack-frameworks like Rails or Sinatra[recommended]). I don't like ASP.Net for the same reason @juzerali mentioned. Other than a web server you could make a web-socket server, which is better than polling. Mar 8, 2012 at 17:30
  • Yes, you can give a serious thought to Node, but proceed with caution, it is very young and not yet beta.
    – Juzer Ali
    Mar 8, 2012 at 19:59

4 Answers 4

3

You can have a look at the APE (Ajax push Engine), as your application requires polling. Its built upon javascript and acts like an Comet server.

Alternatively you can also use one of the paid services for pushing(so that you shouldn't bother much about the server technologies)

1) Pusher

(From pusher homepage : Pusher is a hosted API for quickly, easily and securely adding scalable realtime functionality to web and mobile apps.)

2) UrbanAirship

As @Fabio mentioned Python Tornado can be alternatively used for polling. Its a COMET server, and a lot of realtime web applications are built upon this. There are many tutorials available on polling with NodeJs. A simple google search lead me to this article.

3

The data when accessed over mobile device is going to be costly. So, I would prefer to use JSON / XML to send the data over wire. Would go with RESTful approach to retrieve the data with WCF Restful services / ASP.NET Web API in .NET stack. Also, if you would be considering the battery usage you should avoid polling and should use Signalling frameworks. In .NET stack we have SignalR which does this. This would notify the clients when the new data is available and client would initiate a new request to fetch the data.

If you would like to experiment with new technologies, I would suggest using node.js at the server side and socket.io to communicate from the clients for signalling logic. Also, I would prefer to write the client application using phone gap & javascript so, that it could be easily ported to various platforms.

2

There are countless web technologies that could do it but the thing that stands out for me is this:

There are existing servers (using .net / WCF) that have all the data I want to display.

So you've already got .net kicking around and I can't help thinking that the fastest way to get data out of a .net/WCF server is with a .net/WCF client.

For that reason alone I'd go with asp.net MVC. Gives you a quick and easy path to getting to your data while leaving you with a lot of flexibility with how you handle the "V" part (straight HTML pages, ajax with xml data or json etc)

Just last month asp.net mvc was released under the Apache 2.0 open source license.

For your use-case, I'd keep well away from asp.net webforms and asp.net ajax

edit:

I cannot keep objects in memory and run code independent of client requests. Or at least it's not designed to work like that. Is that correct?

ASP.net (like a lot of application servers) has both session and application scopes you can store data in. You can also create background threads to perform work outside the standard request->response lifycycle.

0

What I can say is:

Use ALWAYS open source technologies :-). There are dozens of libraries/frameworks to write very good webservers but If you need high cuncurrency I can suggest to use event-based frameworks and not thread/process based ones.

Node.js (as said by @withadot) but also Python Tornado are a good choice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.