Monday, October 24, 2011

Project Genesis: Report 6

My final week before the feature freeze - and what a week! A lot of progress as I actually managed to remotely control media state (play/pause) with my cellphone yesterday just before I went to bed. Truly a remarkable feeling!

Last week
Last week I worked on getting the asynchronous communication up and running. I decided to use Juggernaut which runs on a separate server and integrates with Rails to allow the web server to push out data to any connected clients. Juggernaut supports the use of "channels" so we can selectively send out data only to relevant clients. For example only a client which is viewing a configuration would be interested in any updates to that configuration. A client looking at the About page will not be as interested.

Furthermore I have also added the support for both mobile and embedded modes on the server. The modes is initially detected using the user agent string but can be forced by setting the parameters mobile and embedded to either 1 or 0.

The solution was to add two additional mime-types and then use a session cookie to keep track of which version a client wishes to use. Then it is as simple as just adding additional files for each view. For example the profile pages would be:

app/views/users/show.html.erb
app/views/users/show.mobile.erb
app/views/users/show.embedded.erb

Really simple!

The main idea here is that the mobile version will be more compact and fit better in smaller screens while the embedded version will be stripped down and without headers or fancy colors - thus making it integrate well in external applications.

Challenges
The main challenge was the Juggernaut code. I've had trouble having the connection alive for more than five minutes. This means that any client will lose connection to the server and won't receive any updates after five minutes of idling.

The solution to this will be to update to the newer version of Juggernaut (google apparently gave me results of a very old and abandoned version). The new version supports even more methods to get the data out to the clients using protocols such as:

  • WebSocket
  • Adobe Flash Socket
  • ActiveX HTMLFile (IE)
  • Server-Sent Events (Opera)
  • XHR with multipart encoding
  • XHR with long-polling

It also adds some great reconnection support as well as support for SSL. However, I am currently having some trouble installing the new version so we'll see if I can get it fixed this week.

I've also noted that Stoffi is having trouble sending out updates to the server. It seems that the first few requests are sent out fine but then it just stops and hangs when it tries to send any data. Sniffing the network with Wireshark tells me that no data is actually sent onto the network so the problem is somewhere inside .NET (as usual!). I'll have to check it out and see why this is the case.

This week
This week I'm not gonna have much time to continue on the Genesis project. Most of my focus will instead be on getting Shang released so we can move Zhou (the hackathon version) into the beta channel.

Challenges
As usual when it comes to releases the biggest hurdle is to migrate the settings properly. Hopefully my new and improved code in SettingsMigrator will make this job a little easier.

I'll also have to look into the problems with Juggernaut and see if I can solve that before feature freeze.