Unverified Commit eb7cb068 authored by Dan Jones's avatar Dan Jones
Browse files

docs: add comments and examples

+ use response from implicit auth in get auth header
parent dc9e90b9
...@@ -92,6 +92,10 @@ The topics have the following structure: ...@@ -92,6 +92,10 @@ The topics have the following structure:
``` ```
project.operator.vehicleType.vehicleID.[send|receive].messageType project.operator.vehicleType.vehicleID.[send|receive].messageType
# eg
soar.noc.autosub.ah1.send.platform-mission
# or
soar.po.ecosub.eco1.receive.platform-status
``` ```
Subscriptions may contain single-word wildcards (*) or multi-word wildcards (#). Subscriptions may contain single-word wildcards (*) or multi-word wildcards (#).
......
...@@ -47,7 +47,7 @@ class Adapter { ...@@ -47,7 +47,7 @@ class Adapter {
if (!this.tokenValid()) if (!this.tokenValid())
return this.auth().then((response) => { return this.auth().then((response) => {
return { return {
Authorization: `Bearer ${this.credentials.token}`, Authorization: `Bearer ${response.data.token}`,
}; };
}); });
else { else {
......
...@@ -49,7 +49,7 @@ class Adapter { ...@@ -49,7 +49,7 @@ class Adapter {
if (!this.tokenValid()) if (!this.tokenValid())
return this.auth().then((response) => { return this.auth().then((response) => {
return { return {
Authorization: `Bearer ${this.credentials.token}`, Authorization: `Bearer ${response.data.token}`,
}; };
}); });
else { else {
......
...@@ -59,6 +59,9 @@ class GenericProtocol { ...@@ -59,6 +59,9 @@ class GenericProtocol {
/** /**
* Invoked on receiving a message from the backbone * Invoked on receiving a message from the backbone
*
* Whilst type isn't used in the generic stub it will
* be needed by sub-classes overriding the decode method
* @param {string} type * @param {string} type
* @param {object} message * @param {object} message
* @returns {*} * @returns {*}
...@@ -69,6 +72,9 @@ class GenericProtocol { ...@@ -69,6 +72,9 @@ class GenericProtocol {
/** /**
* Optionally invoked before delivering a message to the backbone * Optionally invoked before delivering a message to the backbone
*
* Whilst type isn't used in the generic stub it will
* be needed by sub-classes overriding the encode method
* @param {string} type * @param {string} type
* @param {*} message * @param {*} message
* @returns {object} * @returns {object}
......
...@@ -61,6 +61,9 @@ class GenericProtocol { ...@@ -61,6 +61,9 @@ class GenericProtocol {
/** /**
* Invoked on receiving a message from the backbone * Invoked on receiving a message from the backbone
*
* Whilst type isn't used in the generic stub it will
* be needed by sub-classes overriding the decode method
* @param {string} type * @param {string} type
* @param {object} message * @param {object} message
* @returns {*} * @returns {*}
...@@ -71,6 +74,9 @@ class GenericProtocol { ...@@ -71,6 +74,9 @@ class GenericProtocol {
/** /**
* Optionally invoked before delivering a message to the backbone * Optionally invoked before delivering a message to the backbone
*
* Whilst type isn't used in the generic stub it will
* be needed by sub-classes overriding the encode method
* @param {string} type * @param {string} type
* @param {*} message * @param {*} message
* @returns {object} * @returns {object}
......
...@@ -47,7 +47,7 @@ export class Adapter { ...@@ -47,7 +47,7 @@ export class Adapter {
if (!this.tokenValid()) if (!this.tokenValid())
return this.auth().then((response) => { return this.auth().then((response) => {
return { return {
Authorization: `Bearer ${this.credentials.token}`, Authorization: `Bearer ${response.data.token}`,
}; };
}); });
else { else {
......
...@@ -59,6 +59,9 @@ export class GenericProtocol { ...@@ -59,6 +59,9 @@ export class GenericProtocol {
/** /**
* Invoked on receiving a message from the backbone * Invoked on receiving a message from the backbone
*
* Whilst type isn't used in the generic stub it will
* be needed by sub-classes overriding the decode method
* @param {string} type * @param {string} type
* @param {object} message * @param {object} message
* @returns {*} * @returns {*}
...@@ -69,6 +72,9 @@ export class GenericProtocol { ...@@ -69,6 +72,9 @@ export class GenericProtocol {
/** /**
* Optionally invoked before delivering a message to the backbone * Optionally invoked before delivering a message to the backbone
*
* Whilst type isn't used in the generic stub it will
* be needed by sub-classes overriding the encode method
* @param {string} type * @param {string} type
* @param {*} message * @param {*} message
* @returns {object} * @returns {object}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment