From a346c48d3e32a62422bd56939963ebe9740178f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Dalfors?= Date: Fri, 17 May 2024 09:08:34 +0200 Subject: [PATCH] refine sparkplug detection --- backend/src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/index.ts b/backend/src/index.ts index 9f0df55..0502ae3 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -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)