Sign up

Sign in

WebSockets API

The API for icecondor is based on JSON messages over a websockets connection.

The first step is to open wss://api.icecondor.com. The server will acknowledge the connection with a hello message.

$ wscat wss://api.icecondor.com
opening wss://api.icecondor.com
{"type":"hello","version":"0.2"}

The most frequent operation is to get real-time updates for a particular user. Here is an example. The server response is in bold.

{"type":"follow","username":"iss"}

{"type":"follow","username":"iss","status":"OK","message":"following public profile"}
{"id":"ebab0e45aa867148cb655dc1aba7b9ac","type":"location","username":"iss","date":"2011-12-09T18:56:59.558Z","position":{"latitude":49.59823828074799,"longitude":106.35512952869465}}
Location messages are sent as soon as IceCondor receives a position update for the users being followed. The location message in the previous example is reformatted here for easier reading.
{
    "id": "ebab0e45aa867148cb655dc1aba7b9ac",
    "type": "location",
    "username": "iss",
    "date": "2011-12-09T18:56:59.558Z",
    "position": {
        "latitude": 49.59823828074799,
        "longitude": 106.35512952869465
    }
}

Some operations require authorization. Registration with the site generates an oauth token. Use the token to authenticate.

{"type":"auth", "oauth_token":"iUfD1VNure4rucCOkmA"}

{"type":"auth","status":"OK","user":{"username":"donpdonp","email":"person@example.com","friends":["frontpage","trimet14","iss"],"type":"user","created_at":"2010-08-02T11:01:49Z"}}