mqtt-ingest draft
This commit is contained in:
16
app/src/handlers/topic3.ts
Normal file
16
app/src/handlers/topic3.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { parseUtf8 } from '../helpers/parse.js'
|
||||
import { isNonEmptyString } from '../helpers/validate.js'
|
||||
import type { TopicHandler } from '../types.js'
|
||||
|
||||
export const TOPIC = 'poc/topic3'
|
||||
|
||||
export const handleTopic3: TopicHandler = async (topic, payload) => {
|
||||
const text = parseUtf8(payload)
|
||||
|
||||
if (!isNonEmptyString(text)) {
|
||||
console.warn('topic3.invalid_payload', { topic })
|
||||
return
|
||||
}
|
||||
|
||||
console.log('topic3.received', { topic, text })
|
||||
}
|
||||
Reference in New Issue
Block a user