upd: real time

Deskripsi:
- persiapan real time
- baru coba di pengumuman tapi blm sukses

No Issues
This commit is contained in:
amel
2024-09-18 16:11:52 +08:00
parent bc0f27a4fc
commit 3167b570a7
11 changed files with 396 additions and 24 deletions

View File

@@ -0,0 +1,9 @@
import mtqq from 'mqtt'
declare global {
var mtqq_client: mtqq.MqttClient
}
const mtqq_client = globalThis.mtqq_client ?? mtqq.connect("wss://io.wibudev.com")
export default mtqq_client

View File

@@ -0,0 +1,18 @@
'use client'
import { useEffect } from "react"
import mtqq_client from "./mqtt_client"
export default function MqttLoad() {
useEffect(() => {
mtqq_client.on("connect", () => {
mtqq_client.subscribe("app_SDM")
})
mtqq_client.on("message", (topic, message) => {
const data = JSON.parse(message.toString())
})
}, [])
return <>
</>
}

View File

@@ -19,4 +19,9 @@ export const TEMA = hookstate<IGlobalTema>({
bgFiturHome: "#FCAA4B",
bgFiturDivision: "#FCAA4B",
bgTotalKegiatan: "#DCEED8"
})
export const globalNotifPage = hookstate({
load: false,
category: ''
})