upd: real time
Deskripsi: - persiapan real time - baru coba di pengumuman tapi blm sukses No Issues
This commit is contained in:
9
src/module/_global/bin/mqtt_client.ts
Normal file
9
src/module/_global/bin/mqtt_client.ts
Normal 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
|
||||
18
src/module/_global/bin/mqtt_load.tsx
Normal file
18
src/module/_global/bin/mqtt_load.tsx
Normal 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 <>
|
||||
|
||||
</>
|
||||
}
|
||||
@@ -19,4 +19,9 @@ export const TEMA = hookstate<IGlobalTema>({
|
||||
bgFiturHome: "#FCAA4B",
|
||||
bgFiturDivision: "#FCAA4B",
|
||||
bgTotalKegiatan: "#DCEED8"
|
||||
})
|
||||
|
||||
export const globalNotifPage = hookstate({
|
||||
load: false,
|
||||
category: ''
|
||||
})
|
||||
Reference in New Issue
Block a user