Skip to content

Commit

Permalink
Merge pull request #2839 from HSLdevcom/minor-mqtt-fix
Browse files Browse the repository at this point in the history
Don't unsubscribe unless there are existing topics
  • Loading branch information
optionsome authored Jun 19, 2019
2 parents 7828de7 + 3752c4d commit a45f419
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/util/mqttClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export function parseMessage(topic, message, agency) {
export function changeTopics(settings, actionContext) {
const { client, oldTopics } = settings;

client.unsubscribe(oldTopics);
if (Array.isArray(oldTopics) && oldTopics.length > 0) {
client.unsubscribe(oldTopics);
}
// remove existing vehicles/topics
actionContext.dispatch('RealTimeClientReset');
const topics = settings.options.map(option => getTopic(option, settings));
Expand Down

0 comments on commit a45f419

Please sign in to comment.