OpenBCI / OpenBCI_WIFI

Firmware library that runs on the OpenBCI WiFi Shield
https://shop.openbci.com/collections/frontpage/products/wifi-shield?variant=44534009550
MIT License
34 stars 30 forks source link

Add API endpoint to pass Cloudbrain MQTT Pub/Sub info #14

Closed marionleborgne closed 7 years ago

marionleborgne commented 7 years ago

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:

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:

Note that I will only send the username and password via the POST request. They contain vhost and token info.

Example:

So I will send this in the POST request to the wifi shield:

Size:

andrewjaykeller commented 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

andrewjaykeller commented 7 years ago

How does the vhost work again? that is the topic? The previous topic was amq.topic?

marionleborgne commented 7 years ago

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)

marionleborgne commented 7 years ago

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)

andrewjaykeller commented 7 years ago

So the vhost is prefixed to client id. See http://pubsubclient.knolleary.net/api.html#connect3

so following example username: /hs23bjhg23:demo@getcloudbrain.com

andrewjaykeller commented 7 years ago
marionleborgne commented 7 years ago

I update the top comment based on our discussion