Skip to content

Commit

Permalink
fix: limit general topics with feed ids
Browse files Browse the repository at this point in the history
  • Loading branch information
tekoiv committed Nov 22, 2023
1 parent 4aa4ac6 commit d57e43d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/util/mqttClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ export function changeTopics(settings, actionContext) {

export function startMqttClient(settings, actionContext) {
const options = settings.options || [{}];
const topics = options.map(option => getTopic(option, settings));
let topics = options.map(option => getTopic(option, settings));
// If a general topic is returned, at least limit it to instances feed ids
if (topics[0] === '/gtfsrt/vp/+/+/+/+/+/+/+/+/+/+/+/+/+/+/+/#') {
const { feedIds } = actionContext.config;
topics = feedIds.map(
feedId => `/gtfsrt/vp/${feedId}/+/+/+/+/+/+/+/+/+/+/+/+/+/+/#`,
);
}

return import(/* webpackChunkName: "mqtt" */ 'mqtt').then(mqtt => {
if (settings.gtfsrt) {
Expand Down

0 comments on commit d57e43d

Please sign in to comment.