Skip to content
mmichaud93 edited this page Feb 25, 2015 · 3 revisions

General expectations/guidelines

  • All communication over websockets follows the same guidelines given here with the exception of authorization.
  • Authorization over websockets is done with a sequence of messages, documented below.
  • If messages below are not bidirectional, their direction is documented using one of the following. STP indicates the message flows from sdk to proxy. PTS indicates the message flows from proxy to sdk.

Messages and their expected payloads

api_token [STP]

{
   type:"api_token",
   data:"YOUR API KEY HERE"
}

This is the message an SDK will send initially, to attempt to connect to the service with a given api key. A response message is sent on success or failure, see below.

api_token-response [PTS]

{
  type:"api_token-response",
  data:"RESPONSE MESSAGE, SEE BELOW"
}

This is the message a Proxy will send as a result of receiving a api_token message. the data portion will be used to indicate success or failure of the authentication, with either "OK" for success, or "FAIL" for failure.

logging messages [STP]

{
  type:"TYPE HERE",
  data:...
}
```

The logging messages work exactly as documented [here](https://github.com/hashtag-include/arewegood-web/wiki/Endpoints), for the rest calls. That is, there are currently __four types__ and the data is a _weak-typed_ field.

# Authentication workflow

To authenticate (or attempt to) a client must:

+ Open a websocket to the proxy
+ listen for an `api_token-response` message
+ send an `api_token` message
+ react in accordance to the `api_token-response` `data` contents

Clone this wiki locally