-
Notifications
You must be signed in to change notification settings - Fork 1
websockets
mmichaud93 edited this page Feb 25, 2015
·
3 revisions
- 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.
STPindicates the message flows from sdk to proxy.PTSindicates the message flows from proxy to sdk.
{
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.
{
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.
{
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