The Twilight Sun


Aspect’s messaging model

by Jonathan on Jul.28, 2010, under Aspect, Computers, Programming

(Before I begin, I should warn you that I haven’t had much time to actively work on this yet.)

I found an article about Starbuck’s method of handling coffee orders on Hacker News today. I was surprised, because I had explained this exact concept to some friends already, but using Pat & Oscar’s instead! This kind of query-response architecture strikes me as the perfect model for Aspect, because everything you do constitutes a request, and everything Aspect tells you is some form of response.

The Pat & Oscar’s analogy is a little different from the Starbucks one, though, and it highlights a few key points. If you’ve never been to a Pat & Oscar’s, it works like this: You go to the counter, make your order, receive a number, sit down at a table, and place the number card in the little holder on the table so they can find you. When the order’s ready, they come to you with the food. Importantly, you can make multiple orders and receive multiple numbers, and the orders will be served whenever they’re ready.

Now, how do you apply this to web communication? The classic HTTP protocol has a strictly blocking request/response format, meaning that every request must wait until the response is sent before you can reuse the connection. Most browsers have a cap on how many active connections you can have, and the bare minimum is IE’s two connections. So we need to make this work by using only two connections.

The solution is to use one connection for making requests, and the other for receiving results! You keep the results connection open constantly, and use the other whenever you make a request. The request connection must be closed as quickly as possible, so you just return an “order number”, a job ID. When the job is done, it’s pushed down the response connection along with its job ID. Then you re-connect the response connection so it’s constantly open. The approach the response connection is using is called long polling. Instead of polling periodically, the server hangs on to the connection until it has something to send.

I believe that this is a powerful approach to Comet-like communication. Unlike pure long polling – where the server simply holds the connection instead of responding immediately, and the client doesn’t need to care – it does require some infrastructure on both sides of the network gap. But if it can be abstracted properly, it should really be very easy to use. It’s just a layer you can work on top of.

I’ll be working on this as time permits, and of course I’ll open-source my work on this (though probably not Aspect itself) after a certain point. I’m a firm believer in open-sourcing platforms so everyone can benefit. If anyone else is interested in helping though, I’d be glad to make it public sooner! I think this is a useful model that definitely has applications beyond Aspect.

~Jonathan Castello

1 Comment more...

My Ubuntu Installation Problems

by Jonathan on Feb.18, 2008, under Computers

Having installed Ubuntu myself, I ran into a few annoying (but fixable) problems. I have an HP Pavillion dv900 series laptop, with the touch-sensitive media buttons and a built in wireless receiver. When I installed Ubuntu, I found that (a) my wireless connector wouldn’t work, and (b) that my audio wouldn’t work.

And later, when I fixed (b), I found that Pandora wouldn’t work either. Oh, the horror!

I talked with my Ubuntu-using friend again – knowing another Linux user is a great help! – and I found I had to use something called "ndiswrapper" to use the Windows drivers I had for Linux, to fix my wireless problems. Let’s see if I can dig up the link he gave me… Here it is. Starting from section 3.3, I followed the instructions, and it worked. The only problem is that the light next to the on/off switch for the wireless is always orange, it never turns green (on). But that doesn’t affect the fact that it works.

The audio problem… slightly trickier. I actually can’t remember what fixed it, but it was a pain to solve. I guess I wasn’t very helpful on this one.

And, the problem seemed to be that I didn’t have Flash installed, but when I installed it, it still didn’t work.. suffice to say, it was annoying to try to fix, but eventually I got it.


I can’t overstate the importance of being able to talk with someone else who has Ubuntu while doing this. It’s a huge help.

5 Comments more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...