fix(pskr): require both ends in CONUS for MQTT subscriptions
Pin both the sender and receiver DXCC slots to 291 so the broker only forwards CONUS↔CONUS spots. The previous two-topic-per-band filter (sender_us OR receiver_us) was leaking US↔CA paths through the receiver-side wildcard, and the project doesn't have NWP coverage for the non-US end yet. When HRDPS lights up we'll add a Canada-anchored topic alongside.
This commit is contained in:
parent
b924cc2fc2
commit
a1f561dfb8
1 changed files with 9 additions and 12 deletions
|
|
@ -5,11 +5,11 @@ defmodule Microwaveprop.Pskr.Client do
|
||||||
Connects to `mqtt.pskreporter.info:1883` over plain TCP (the
|
Connects to `mqtt.pskreporter.info:1883` over plain TCP (the
|
||||||
broker doesn't expose TLS), subscribes to a curated set of
|
broker doesn't expose TLS), subscribes to a curated set of
|
||||||
topics, and forwards every PUBLISH payload to
|
topics, and forwards every PUBLISH payload to
|
||||||
`Pskr.Aggregator.ingest/2`. Each topic anchors on USA (DXCC 291)
|
`Pskr.Aggregator.ingest/2`. Each topic anchors **both** ends on
|
||||||
on either the sender or receiver side so the broker pre-filters
|
USA (DXCC 291) so we only ingest CONUS-to-CONUS paths — that's
|
||||||
out the bulk of the firehose before it reaches us — the
|
the only path geometry where both endpoints sit inside HRRR
|
||||||
alternative would be subscribing to `pskr/filter/v2/#` and
|
coverage. When HRDPS lights up we'll add a Canada-anchored
|
||||||
dropping ~95% client-side.
|
topic alongside.
|
||||||
|
|
||||||
## No external MQTT library
|
## No external MQTT library
|
||||||
|
|
||||||
|
|
@ -238,18 +238,15 @@ defmodule Microwaveprop.Pskr.Client do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp subscribe_packet(bands) do
|
defp subscribe_packet(bands) do
|
||||||
topics =
|
topics = Enum.map(bands, fn band -> {topic_for(band), 0} end)
|
||||||
Enum.flat_map(bands, fn band ->
|
|
||||||
[{topic_for(band, :sender_us), 0}, {topic_for(band, :receiver_us), 0}]
|
|
||||||
end)
|
|
||||||
|
|
||||||
Mqtt.subscribe(1, topics)
|
Mqtt.subscribe(1, topics)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Topic order (from the broker's landing page):
|
# Topic order (from the broker's landing page):
|
||||||
# pskr/filter/v2/<band>/<mode>/<sc>/<rc>/<sl>/<rl>/<sa>/<ra>
|
# pskr/filter/v2/<band>/<mode>/<sc>/<rc>/<sl>/<rl>/<sa>/<ra>
|
||||||
defp topic_for(band, :sender_us), do: "pskr/filter/v2/#{band}/+/+/+/+/+/#{@us_dxcc}/+"
|
# Both DXCC slots pinned to USA so the broker drops US↔CA, US↔EU,
|
||||||
defp topic_for(band, :receiver_us), do: "pskr/filter/v2/#{band}/+/+/+/+/+/+/#{@us_dxcc}"
|
# etc. before the spots ever reach us.
|
||||||
|
defp topic_for(band), do: "pskr/filter/v2/#{band}/+/+/+/+/+/#{@us_dxcc}/#{@us_dxcc}"
|
||||||
|
|
||||||
# ---------- Inbound dispatch ----------
|
# ---------- Inbound dispatch ----------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue