refine sparkplug detection

This commit is contained in:
Björn Dalfors
2024-05-17 09:08:34 +02:00
parent 8a2c39ba8e
commit a346c48d3e

View File

@@ -48,7 +48,8 @@ export class ConnectionManager {
}
let decoded_payload = null
if (topic.startsWith("spBv1.0/")) {
// spell-checker: disable-next-line
if (topic.match(/spBv1\.0\/[^/]+\/(DDATA|NDATA|NCMD|DCMD|NBIRTH|DBIRTH|NDEATH|DDEATH\/[^/]+\/)/u)) {
decoded_payload = SparkplugDecoder.decode(buffer)
} else {
decoded_payload = Base64Message.fromBuffer(buffer)