Tuesday, June 23, 2009

Open Source Client Simulator

In these days of web 2.0, it's quite common to build clients and servers that communicate with each other. Debugging the communication can be a pain, especially if you're not in control of one end of the connection. This is particularly the case with a service like Twilio, one of a bunch of telephony providers that you can connect your server to. With Twilio, every live test you do requires making or receiving a phone call. This is arduous, takes time, and costs money in phone charges.


So, I wrote a simple simulator to simulate the Twilio server contacting my server, which I released today as open source.

Chlorine is a simple, small (400 lines of JavaScript), and easy-to-use client simulator. It doesn't do much but it does the essentials to allow you to debug a protocol:
  • Submits requests to your server via GET or POST.
  • Displays the results back in a readable fashion, minus the contents of comments and CDATA blocks.
  • Supplies a link you can use to GET the raw response from the server if you need to inspect it (for example, when the server doesn't actually return XML, so it can't be parsed)..
  • Turns any attribute or text value in the result that looks like a URL into a form which will submit that URL back to the server, along with any parameter values you specify.
  • Allows you to configure it to add additional parameter fields to each form that is created.
Chlorine itself is generic, but I've included a version which is configured for use with Twilio. 

Chlorine is available at http://chlorine.googlecode.com

0 comments:

Post a Comment