Skip to content

Commit cf9336a

Browse files
committed
Updated MQTT docs to include api key substitution
1 parent f598d3b commit cf9336a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

content/concepts/mqtt.textile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ An example of how you might configure an MQTT client to connect through an "MQTT
4949
```[javascript]
5050
var options = {
5151
keepalive: 60,
52-
username: 'FIRST_HALF_OF_API_KEY',
53-
password: 'SECOND_HALF_OF_API_KEY',
52+
username: '{{API_KEY_NAME}}',
53+
password: '{{API_KEY_SECRET}}',
5454
port: 8883
5555
};
5656
var client = mqtt.connect('mqtts:mqtt.ably.io', options);
@@ -59,7 +59,7 @@ var client = mqtt.connect('mqtts:mqtt.ably.io', options);
5959
Any data published through or received by an MQTT broker will be binary encoded as MQTT is a binary protocol. This means that you’ll need to interpret the message to get the original contents out. Here’s how it looks using Ably and JavaScript:
6060

6161
```[javascript]
62-
var ably = new Ably.Realtime('REPLACE_WITH_YOUR_API_KEY');
62+
var ably = new Ably.Realtime('{{API_KEY}}');
6363
var decoder = new TextDecoder();
6464
var channel = ably.channels.get('input');
6565
channel.subscribe(function(message) {

content/mqtt/index.textile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ h2(#decoding). Decoding MQTT communication
7474
Any data published through or received by the MQTT adapter will be binary encoded, due to MQTT being a binary protocol. This means that you'll need to interpret the message to get the original contents out. For example, to interpret a message using "Ably Realtime":https://www.ably.io/documentation/realtime with JavaScript you'd need to do the following, using the "text-encoding NPM module's TextDecoder":https://www.npmjs.com/package/text-encoding to decode from binary to text:
7575

7676
bc[javascript]. {
77-
var ably = new Ably.Realtime('REPLACE_WITH_YOUR_API_KEY');
77+
var ably = new Ably.Realtime('{{API_KEY}}');
7878
var decoder = new TextDecoder();
7979
var channel = ably.channels.get('my_channel');
8080
channel.subscribe(function(message) {

0 commit comments

Comments
 (0)