Some of the most useful products arise out of solving very specific problems and realizing that the solution you came up with would be useful to other people with similar problems. That’s how the Sybase Relay Server came to be.
In the fall of 2000 (almost 10 years ago as I write this) I was working on a now-defunct product called the iAnywhere Wireless Server, or iAWS for short. The mobile web application market was in its infancy and iAWS made it easier to build wireless web apps that integrated with databases and other enterprise-class backend systems. This was back in the day when WAP and WML were the hot things and the idea of running full-fledged applications on a mobile phone was a dream, not today’s reality.
Anyhow, one of the biggest problems with wireless development was that we couldn’t access our desktop computers from the phones we were testing with. The company firewall made it impossible. So what we did was arrange to get a couple of computers placed outside the firewall on a separate Internet connection arranged just for that purpose.
That worked, but it was very awkward to use. Essentially you had to use remote desktop to connect to the outside computer from your desktop, copy the files you wanted to test to the computer (or create/edit them in place), and then run your tests by having the mobile phone connect to the outside computer. It worked, but as I said, it was awkward. Also, we only had one computer outside that developers could use, the others were reserved for product management and the sales team (so they could demo stuff — they had the same access problems), and that led to contention.
The HTTP Relay
After suffering through this process, I decided there had to be a better way to do things. All I really needed was a way to access the local web server running on my desktop computer with HTTP requests from outside the firewall. Then I could make changes locally (with my text editor) and test those changes immediately on my mobile device. No copying files back and forth and no remote desktops to fiddle with. Even looking at log files would be simpler. What I needed was a simple HTTP “relay” that could cross the corporate firewall and let me do what I needed to do.
I wrote a simple Java program called HTTPRelay that could be run in two modes. In external mode it would open two server sockets, one listening for incoming HTTP connections from mobile devices (or any browser, really) and one listening for a connection from another copy of HTTPRelay. Any data received on one connection would be automatically relayed to the other. In internal mode it would open an outgoing socket connection to another copy of HTTPRelay and an outgoing connection to the local web server. Again, any data received on one connection would be relayed to the other.
HTTPRelay ran on the outside computer (the one outside our firewall) in external mode. You ran a second copy of HTTPRelay on your own desktop computer in internal mode. The two relays shared a socket connection, which the internal relay initiated in order to cross the corporate firewall.
You connected to the external relay from your mobile phone. The HTTP request was relayed to the internal relay, which in turn sent it to the local web server. The response was relayed back from the internal relay to the external relay and back to the phone. To the phone, the external relay was a proxy server for the web server running on your desktop computer. It was seamless.
I had the system set up so that up to 8 developers could simultaneously do mobile web development, each on their own computer, simply by assigning different port numbers to different developers. It wasn’t a very sophisticated system, but it worked, and it saved us a lot of hassle.
Today’s Relay Server
Fast forward a few years and things haven’t changed that much. Anyone doing mobile application development (browser-based or not) runs in to the same kind of firewall issues. While the Sybase Relay Server is a completely different product than the HTTPRelay I hacked together one day, the basic idea is the same: run an external relay and have the internal data servers connect to it using outgoing socket connections. Use HTTP as the transport protocol, make the relay server robust and scalable, and everyone’s happy. That’s why MobiLink, Afaria and Mobile Office all use the relay server — see the Sybase Relay Server whitepaper for details.