How the Client and Other Tools Get Your Data from Sailonline

Time for some demystification…

I know it seems to many that accessing boat (and weather, etc) data from sailonline requires some insider knowledge or special privileges on the server even, but this is not the case. Obviously some technical knowledge is required, but that is all – nothing more.

The actual race client makes a series of normal HTTP (web) requests to the server, and gets back responses containing the various data in plain text (in some cases the text has been compressed to speed things up or save download bandwidth). This text data is formated in what is called XML, for eXtensible Markup Language – which is mostly a way to describe the data, using tags similar to the way HTML does, except that XML leaves specifying the exact tags up to its users – for example, HTML defines the ‘b’ tag to instruct the web browser to render some text as bold. When the browser sees ‘<b>This is Bold Text</b>’ it displays the text between as bold. These tags can be nested, so to have bold and italic text, the web page uses ‘<i><b>Bold, italicised text</b></i>’.

XML works the same, except we, the Sailonline developers, get to specify what the tags are and what they mean. So for example we might use:

 <fleet>
   <boat> <name>RainbowChaser</name> <sog>11.02</sog> ** more data ** </boat>
   <boat> *Another boat's data* </boat>
   ** More boats listed here **
 </fleet>

You can see the similarity with HTML… There would be one ‘boat’ entity for every boat in the fleet… Similarly, every time the race client updates your boat, it receives some XML containing all the data for your boat.

And it is actually not too difficult to get your browser to display this raw data yourself – which is really all any tools (official client, or otherwise) do, to get your boat data.

If you use the ‘View Source’ function of your browser with a sailonline race open, you will see a lot of html, and some javascript. Don’t worry, most of it is Google related but the bit that interests us here is near the top and looks like this:

function getToken()
{
 return "efbe46849926b84f1bcfe985ab55e57b";
}

The server actually constructs a special page, unique to you and containing your token, when you click the ‘Go To Race’ button on the homepage. This is how the Flash client gets your boat token – the Flash code can ‘talk to’ the javascript on the webpage containing the Flash application.

What a token is, is a unique identifier that the sailonline server creates for you, every time you login to a race. It associates a specific boat with a specific race. When writing a tool to use sailonline server data, getting the token is probably the trickiest step. Now whenever the client or any other tool wants updated boat information it makes a request to a specific URL, passing this token along with it (you will see similar on other web pages, information appearing after a ‘?’ symbol in Google queries for example)

http://www.sailonline.org/webclient/boat.xml?token=efbe46849926b84f1bcfe985ab55e57b

So even though everyone’s client is making requests to sailonline.org/webclient/boat.xml, we all provide different tokens. The server then uses that token to lookup your boat data and send it back. I can’t see your data, and you can’t see mine.

If you take that URL, but put in your own token (which you can see with ‘view source’ in your browser), and enter it as the URL in a browser tab – you will see the raw data that the server sends out. Some browsers will show the full XML, others (ie Chrome) only show the actual data values (not the tags).

ALL the various data – fleet, tracks, weather, maps, course and polar etc is all delivered in this way. Open up the ‘Developer Tools’ in the Chrome browser, switch to the network tab and you can see all this data being requested…

 

It is my hope that by posting this information, people will better understand that there is no ‘elite’ group within SOL able to do things others can’t (except for having the requisite knowledge/skills). That no-one else can gain control of your boat without your password,  gain unfair advantage or do any other nefarious things.

The same data is available to all – the only difference is whether you know how to access it… But similar skill disparities exists in all endeavours

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: