Closed marionleborgne closed 7 years ago
should we add host
to the body? i.e. the current is mock.getcloudbrain.com
but when that changes... i don't want to have to people to have to reprogram their devices
How does the vhost
work again? that is the topic? The previous topic was amq.topic
?
The vhost was "/" previously. When using authentication we do not use root but we partition users using a uuid for the vhost.
So now the vhost would be something like "/h2h5gs7b2s77ashb..."
The vhost is independent from the topic. So far our example topic was "amq.topic" (but "hello" or any other string that pub & sub agree on is fine)
The vhost was "/" previously. When using authentication we do not use root but we partition users using a uuid for the vhost.
So now the vhost would be something like "/h2h5gs7b2s77ashb..."
The vhost is independent from the topic. So far our example topic was "amq.topic" (but "hello" or any other string that pub & sub agree on is fine)
So the vhost
is prefixed to client id.
See http://pubsubclient.knolleary.net/api.html#connect3
so following example username:
/hs23bjhg23:demo@getcloudbrain.com
openbci
I update the top comment based on our discussion
We want to add an API endpoint so that we can pass information to the wifi shield board:
This info is what will allow the MQTT pub/sub system on the board to receive / send data to cloudbrain.
Here is the endpoint spec that can be added to the wifi shield swagger api doc:
POST /mqtt
application/json
{"broker_address": <url | ip>, "username": <string>, "password" : <string>}
{"broker_address": "broker.getcoudbrain.com", "username": "/hs23bjhg23:ajg3486hk4", "password" : ""}
Hitting this API endpoint should set the
username
andpassword
variables on the board and start the MQTT pub/sub service.Needed by your MQTT client to send data to rabbitmq:
username = <vhost>:<token>
password = ""
topic = openbci
Note that I will only send the username and password via the POST request. They contain
vhost
andtoken
info.Example:
token = "a253c7a141daca0dc6bfe5f51bee7ef5f1ca4b9cb9807ff0ea1f1737f771f573"
vhost = "/a253c7a141daca0dc6bfe5f51bee7ef5f1ca4b9cb9807ff0ea1f1737f771f573"
So I will send this in the POST request to the wifi shield:
username = "/a253c7a141daca0dc6bfe5f51bee7ef5f1ca4b9cb9807ff0ea1f1737f771f573:a253c7a141daca0dc6bfe5f51bee7ef5f1ca4b9cb9807ff0ea1f1737f771f573"
password = ""
Size:
len(token) = 64
len(vhost) = 65
len(username) = 65 + 1 + 64 = 130
len(password) = 0