Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
fix typo, accept region as broker, pass on connack, pass on end args,…
Browse files Browse the repository at this point in the history
… for #1
  • Loading branch information
FokkeZB committed Sep 2, 2016
1 parent 56029be commit 0da1445
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
const Client = class Client extends EventEmitter {
constructor(broker, appEUI, appAccessKey) {
super();
if (!broker.includes('.')) {
broker += '.thethings.network';
}
this.appEUI = appEUI;
this.legacy = (broken === 'staging.thethingsnetwork.org');
this.legacy = (broker === 'staging.thethingsnetwork.org');
this.client = mqtt.connect(util.format('mqtt://%s', broker), {
username: appEUI,
password: appAccessKey
Expand All @@ -20,7 +23,7 @@
}

end() {
this.client.end();
this.client.end.apply(this.client, arguments);
}

downlink(devEUI, payload, ttl, port) {
Expand All @@ -37,8 +40,10 @@
this.client.publish(topic, message);
}

_connected() {
super.emit('connect');
_connected(connack) {
super.emit('connect', {
connack: connack
});
this.client.subscribe(['+/devices/+/activations', '+/devices/+/up']);
}

Expand Down

0 comments on commit 0da1445

Please sign in to comment.