控制初始化
This commit is contained in:
@@ -84,20 +84,6 @@ export function getWorkStatistics(params) {
|
||||
}
|
||||
|
||||
|
||||
// 判断是否能控制
|
||||
export function getControlRight(params) {
|
||||
const dataStr = localStorage.getItem('userInfo');
|
||||
let parse = JSON.parse(dataStr);
|
||||
var token = parse?.token;
|
||||
return api({
|
||||
url: `/websocket/judgeConnection`,
|
||||
method: 'get',
|
||||
headers: {
|
||||
Authorization: token // token 正常带上
|
||||
},
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 登录
|
||||
@@ -284,14 +270,6 @@ export function getAlimage(params) {
|
||||
})
|
||||
}
|
||||
|
||||
// 远程遥控 判断是否有权限/forward/device/remoteControl platform:web
|
||||
export function getJurisdiction(data) {
|
||||
return api({
|
||||
url: '/forward/device/remoteControl',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//下载割草任务记录
|
||||
|
||||
@@ -23,3 +23,21 @@ export function getLiveStream(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getControlRight(params) {
|
||||
return request({
|
||||
url: `/websocket/judgeConnection`,
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 远程遥控 判断是否有权限/forward/device/remoteControl platform:web
|
||||
export function getJurisdiction(data) {
|
||||
return request({
|
||||
url: '/forward/device/remoteControl',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
2335
src/components/devices/DeviceControl.tsx
Normal file
2335
src/components/devices/DeviceControl.tsx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,76 +1,51 @@
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import React, { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
||||
import {
|
||||
Row, Col, Card, Statistic, Tag, Typography,
|
||||
Space, Empty, Descriptions, Badge, Progress, Button,
|
||||
Divider, Select
|
||||
Divider, Select, message, Modal
|
||||
} from 'antd';
|
||||
import {
|
||||
ThunderboltOutlined, DashboardOutlined, AimOutlined,
|
||||
EnvironmentOutlined, RocketOutlined, GlobalOutlined,
|
||||
VideoCameraOutlined, ControlOutlined, FullscreenOutlined
|
||||
VideoCameraOutlined, ControlOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import XboxController from './XboxController';
|
||||
import DroneLivePlayer from '../VolcRtcPlayer.jsx';
|
||||
import { getLiveStream } from '../../api/device.ts';
|
||||
import { getLiveStream, getControlRight, getJurisdiction } from '../../api/device.ts';
|
||||
import CesiumMap from '../Map.jsx';
|
||||
import { wsManager } from '../WebSocketManager.ts';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '@/src/store/index.ts';
|
||||
import envConfig from '../../../env';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
const { Text } = Typography;
|
||||
|
||||
// 模拟地图组件
|
||||
const MockMap = ({ longitude, latitude }) => (
|
||||
<div style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
background: '#e6f7ff url(https://picsum.photos/seed/map/1200/800) center/cover',
|
||||
borderRadius: 8,
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
}}>
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: 16,
|
||||
left: 16,
|
||||
background: 'rgba(255,255,255,0.9)',
|
||||
padding: '8px 12px',
|
||||
borderRadius: 4,
|
||||
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
||||
zIndex: 10
|
||||
}}>
|
||||
<div style={{ fontSize: 12, fontWeight: 'bold', marginBottom: 4 }}>实时坐标</div>
|
||||
<div style={{ fontSize: 12 }}>经度: {longitude || '118.78'}</div>
|
||||
<div style={{ fontSize: 12 }}>纬度: {latitude || '32.06'}</div>
|
||||
</div>
|
||||
<div style={{
|
||||
width: 24,
|
||||
height: 24,
|
||||
background: '#1890ff',
|
||||
borderRadius: '50%',
|
||||
border: '3px solid #fff',
|
||||
boxShadow: '0 0 10px rgba(24,144,255,0.8)',
|
||||
position: 'relative'
|
||||
}}>
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: -30,
|
||||
left: '50%',
|
||||
transform: 'translateX(-50%)',
|
||||
background: '#1890ff',
|
||||
color: '#fff',
|
||||
padding: '2px 8px',
|
||||
borderRadius: 4,
|
||||
fontSize: 10,
|
||||
whiteSpace: 'nowrap'
|
||||
}}>当前设备</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
const OBSTACLE_TYPE = {
|
||||
0: '未知',
|
||||
1: '人',
|
||||
2: '车辆',
|
||||
3: '围栏',
|
||||
4: '坑洞',
|
||||
5: '草丛',
|
||||
};
|
||||
|
||||
export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceChange }) {
|
||||
const [planeVideo, setPlaneVideo] = useState([]);
|
||||
const [isControlled, setIsControlled] = useState(false);
|
||||
const [wsDeviceInfo, setWsDeviceInfo] = useState({});
|
||||
const [wsStatus, setWsStatus] = useState('disconnected');
|
||||
const [isRequestControl, setIsRequestControl] = useState(false);
|
||||
const connectedDeviceSnRef = useRef(null);
|
||||
const requestDeviceId = useRef('');
|
||||
const controlRef = useRef(false);
|
||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
|
||||
// 权限请求弹窗相关
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [modalContent, setModalContent] = useState({ title: '', content: '' });
|
||||
const [modelType, setModelType] = useState('');
|
||||
const [hasControlRight, setHasContronRight] = useState(false);
|
||||
|
||||
// 获取选中的设备详情
|
||||
const device = useMemo(() => {
|
||||
@@ -81,11 +56,20 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
|
||||
|
||||
// 判断是否为无人机
|
||||
const isUAV = useMemo(() => {
|
||||
|
||||
return device && (device.device_sn);
|
||||
}, [device]);
|
||||
|
||||
const runningStatus = device?.lastRunningStatus || {};
|
||||
// 优先显示 WebSocket 推送的实时数据,如果没有则显示接口返回的 lastRunningStatus
|
||||
const runningStatus = useMemo(() => {
|
||||
const baseStatus = device?.lastRunningStatus || {};
|
||||
if (!isUAV && Object.keys(wsDeviceInfo).length > 0) {
|
||||
return {
|
||||
...baseStatus,
|
||||
...wsDeviceInfo
|
||||
};
|
||||
}
|
||||
return baseStatus;
|
||||
}, [device, wsDeviceInfo, isUAV]);
|
||||
|
||||
// 辅助函数:数字格式化
|
||||
const fix2 = (val) => {
|
||||
@@ -96,6 +80,183 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
|
||||
// 辅助函数:安全取值
|
||||
const getVal = (val) => val === "no_rain" ? "无" : (val || '-');
|
||||
|
||||
// 获取权限
|
||||
const getControl = useCallback((serialnum) => {
|
||||
const data = { platform: "web", deviceId: serialnum };
|
||||
getJurisdiction(data).then(res => {
|
||||
if (res?.code == 200 && res?.data?.remoteControl == true) {
|
||||
controlRef.current = true;
|
||||
setIsControlled(true);
|
||||
} else {
|
||||
controlRef.current = false;
|
||||
setIsControlled(false);
|
||||
}
|
||||
}).catch(err => {
|
||||
controlRef.current = false;
|
||||
setIsControlled(false);
|
||||
})
|
||||
}, []);
|
||||
|
||||
const showModal = (content, type) => {
|
||||
setModalContent(content);
|
||||
setModelType(type);
|
||||
setIsModalOpen(true);
|
||||
};
|
||||
|
||||
const sendPermissionRequest = (data, type) => {
|
||||
const wsdata = {
|
||||
type: type,
|
||||
switchResult: data,
|
||||
token: userInfo.token,
|
||||
deviceId: type === "switchPermission" ? connectedDeviceSnRef.current : requestDeviceId.current,
|
||||
userName: userInfo.username,
|
||||
};
|
||||
wsManager.send(wsdata);
|
||||
};
|
||||
|
||||
const handleOk = () => {
|
||||
sendPermissionRequest(true, modelType);
|
||||
if (modelType === "switchPermission") {
|
||||
setIsRequestControl(true);
|
||||
messageApi.loading({
|
||||
key: "control",
|
||||
content: '权限请求中...',
|
||||
duration: 0,
|
||||
});
|
||||
} else {
|
||||
if (requestDeviceId.current === connectedDeviceSnRef.current) {
|
||||
controlRef.current = false;
|
||||
setIsControlled(false);
|
||||
}
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
if (modelType === "switchPermission") {
|
||||
setIsRequestControl(false);
|
||||
} else {
|
||||
sendPermissionRequest(false, modelType);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
|
||||
// WebSocket 消息处理
|
||||
const handleWsMessage = useCallback((messageData) => {
|
||||
switch (messageData.type) {
|
||||
case 'deviceInfo':
|
||||
const deviceData = {};
|
||||
messageData.data.forEach(item => {
|
||||
deviceData[item.name] = item.value;
|
||||
});
|
||||
setWsDeviceInfo(deviceData);
|
||||
break;
|
||||
case 'AUTH':
|
||||
if (messageData.isAuth === true) {
|
||||
getControl(connectedDeviceSnRef.current);
|
||||
}
|
||||
break;
|
||||
case 'switchResult':
|
||||
messageApi.success({
|
||||
content: '权限获取成功',
|
||||
key: 'control',
|
||||
duration: 2,
|
||||
});
|
||||
setIsRequestControl(false);
|
||||
controlRef.current = true;
|
||||
setIsControlled(true);
|
||||
break;
|
||||
case 'switchPermission':
|
||||
console.log("平台请求权限", messageData.platform);
|
||||
const rawPlatform = messageData.platform;
|
||||
if (rawPlatform == "null") {
|
||||
console.log("platform 为空,终止逻辑");
|
||||
return;
|
||||
}
|
||||
|
||||
const platform = (messageData.platform || '').toLowerCase().trim();
|
||||
if (platform === "web" || !platform) {
|
||||
console.log("检测到web平台,执行return终止逻辑");
|
||||
return;
|
||||
}
|
||||
requestDeviceId.current = messageData.deviceId;
|
||||
showModal({
|
||||
title: "权限请求",
|
||||
content: `${messageData.platform || '未知平台'}请求控制${requestDeviceId.current === connectedDeviceSnRef.current ? "" : requestDeviceId.current}权限, 是否同意?`
|
||||
}, 'switchResult');
|
||||
break;
|
||||
case 'detectionReport':
|
||||
const obsData = messageData.data;
|
||||
if (obsData && obsData.deviceId === connectedDeviceSnRef.current) {
|
||||
const type = obsData?.obstacle?.type;
|
||||
const isSecure = obsData?.isSecure;
|
||||
const distance = obsData?.obstacle?.distance?.toFixed(2);
|
||||
if (isSecure) return;
|
||||
|
||||
messageApi.warning({
|
||||
key: 'obstacle-warning',
|
||||
content: `设备检测到${OBSTACLE_TYPE[type] ?? '未知物'},距离 ${distance}m!`,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, [getControl, messageApi]);
|
||||
|
||||
// 连接设备 WebSocket
|
||||
const connectDevice = useCallback(async (targetDevice) => {
|
||||
if (!targetDevice || isUAV) return;
|
||||
|
||||
wsManager.close();
|
||||
connectedDeviceSnRef.current = null;
|
||||
setWsDeviceInfo({});
|
||||
|
||||
const token = userInfo.token;
|
||||
console.log(token, "token", userInfo)
|
||||
const userName = userInfo.username;
|
||||
|
||||
const wsUrl = envConfig.WS_URL || "wss://ri.satabot.com/ws/";
|
||||
wsManager.connect(targetDevice.serialNumber || targetDevice.device_sn, wsUrl);
|
||||
|
||||
try {
|
||||
const res = await getControlRight({
|
||||
userName,
|
||||
sourceType: 1,
|
||||
token,
|
||||
});
|
||||
|
||||
if (res?.code == 200) {
|
||||
connectedDeviceSnRef.current = targetDevice.serialNumber || targetDevice.device_sn;
|
||||
setHasContronRight(true);
|
||||
await getControl(connectedDeviceSnRef.current);
|
||||
} else {
|
||||
setHasContronRight(false);
|
||||
messageApi.warning("其他端正在控制");
|
||||
}
|
||||
} catch (err) {
|
||||
messageApi.error("权限校验失败");
|
||||
}
|
||||
}, [isUAV, getControl, userInfo, messageApi]);
|
||||
|
||||
useEffect(() => {
|
||||
if (device) {
|
||||
connectDevice(device);
|
||||
}
|
||||
return () => {
|
||||
wsManager.close();
|
||||
};
|
||||
}, [device, connectDevice]);
|
||||
|
||||
// 监听 WS 状态和消息
|
||||
useEffect(() => {
|
||||
const unsubStatus = wsManager.onStatusChange(setWsStatus);
|
||||
const unsubMsg = wsManager.onMessage(handleWsMessage);
|
||||
return () => {
|
||||
unsubStatus();
|
||||
unsubMsg();
|
||||
};
|
||||
}, [handleWsMessage]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!device?.gateway_sn) {
|
||||
setPlaneVideo([]);
|
||||
@@ -117,36 +278,52 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
|
||||
}, [device]);
|
||||
|
||||
const handleGamepadUpdate = (state) => {
|
||||
// console.log('Gamepad Update:', state);
|
||||
if (!isControlled || !connectedDeviceSnRef.current) return;
|
||||
|
||||
// 参考 DeviceControl.tsx 的逻辑发送手柄指令
|
||||
const payload = {
|
||||
type: 'gamepad',
|
||||
deviceId: connectedDeviceSnRef.current,
|
||||
data: {
|
||||
axes: state.axes,
|
||||
buttons: state.buttons
|
||||
}
|
||||
};
|
||||
wsManager.send(payload);
|
||||
};
|
||||
|
||||
const handleControlModal = ({ control }) => {
|
||||
setIsControlled(control);
|
||||
};
|
||||
|
||||
if (!device) {
|
||||
return <Empty description="请选择一个设备以查看状态" style={{ marginTop: 100 }} />;
|
||||
const handleControlModal = (data) => {
|
||||
if (isRequestControl) return;
|
||||
if (data.control == true) {
|
||||
showModal({ title: "权限请求", content: "是否请求控制权限?" }, 'switchPermission');
|
||||
} else {
|
||||
setIsModalOpen(false);
|
||||
}
|
||||
}
|
||||
|
||||
// 归一化地图显示的设备列表
|
||||
const mapDevices = useMemo(() => {
|
||||
if (!device) return [];
|
||||
// 确保地图组件能正确读取到经纬度
|
||||
const normalizedDevice = {
|
||||
...device,
|
||||
lastRunningStatus: {
|
||||
...device.lastRunningStatus,
|
||||
longitude: device.lastRunningStatus?.longitude || device.longitude,
|
||||
latitude: device.lastRunningStatus?.latitude || device.latitude,
|
||||
longitude: runningStatus.longitude || device.longitude,
|
||||
latitude: runningStatus.latitude || device.latitude,
|
||||
},
|
||||
name: device.deviceAlias || device.callsign || device.deviceName || '当前设备',
|
||||
type: isUAV ? 'drone' : (device.productName?.includes('割草机') ? 'mower' : 'robot')
|
||||
};
|
||||
return [normalizedDevice];
|
||||
}, [device, isUAV]);
|
||||
}, [device, isUAV, runningStatus]);
|
||||
|
||||
if (!device) {
|
||||
return <Empty description="请选择一个设备以查看状态" style={{ marginTop: 100 }} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ padding: '0px' }}>
|
||||
{contextHolder}
|
||||
<div style={{ marginBottom: 16, display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
<Text strong>选择设备:</Text>
|
||||
<Select
|
||||
@@ -166,7 +343,14 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
|
||||
{isUAV ? '无人机' : '机器人'}
|
||||
</Tag>
|
||||
)}
|
||||
</div>
|
||||
{wsStatus === 'connected' && (
|
||||
<Badge
|
||||
status="processing"
|
||||
color="#52c41a"
|
||||
text="实时连接中"
|
||||
style={{ color: '#52c41a' }}
|
||||
/>
|
||||
)} </div>
|
||||
|
||||
<Row gutter={[16, 16]}>
|
||||
{/* 左侧:视频和地图 */}
|
||||
@@ -286,31 +470,31 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
|
||||
/>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={<><DashboardOutlined /> 系统电压</>}>
|
||||
<Text strong style={{ fontSize: 16 }}>{runningStatus.voltage || '-'} V</Text>
|
||||
<Text strong style={{ fontSize: 16 }}>{fix2(runningStatus.voltage)} V</Text>
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label="左电机电流">
|
||||
<Text>{runningStatus?.leftCurrent || '-'} A</Text>
|
||||
<Text>{fix2(runningStatus?.leftCurrent)} A</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="右电机电流">
|
||||
<Text>{runningStatus?.rightCurrent || '-'} A</Text>
|
||||
<Text>{fix2(runningStatus?.rightCurrent)} A</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="左轮速度">
|
||||
<Text>{runningStatus?.leftMeasureSpeed || '-'} A</Text>
|
||||
<Text>{fix2(runningStatus?.leftMeasureSpeed)} m/s</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="右轮速度">
|
||||
<Text>{runningStatus?.rightMeasureSpeed || '-'} A</Text>
|
||||
<Text>{fix2(runningStatus?.rightMeasureSpeed)} m/s</Text>
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label="左电机温度">
|
||||
<Text>{runningStatus?.leftMotorTemp || '-'} ℃</Text>
|
||||
<Text>{fix2(runningStatus?.leftMotorTemp)} ℃</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="右电机温度">
|
||||
<Text>{runningStatus?.rightMotorTemp || '-'} ℃</Text>
|
||||
<Text>{fix2(runningStatus?.rightMotorTemp)} ℃</Text>
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label="主控温度">
|
||||
<Text>{runningStatus?.chipTemp || '-'} ℃</Text>
|
||||
<Text>{fix2(runningStatus?.chipTemp)} ℃</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="卫星数量">
|
||||
<Badge showZero={true}
|
||||
@@ -318,10 +502,10 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label="偏航角 (Yaw)">
|
||||
<Text>{runningStatus?.yaw || '-'}°</Text>
|
||||
<Text>{fix2(runningStatus?.yaw)}°</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="俯仰角 (Pitch)">
|
||||
<Text>{runningStatus?.pitch || '-'}°</Text>
|
||||
<Text>{fix2(runningStatus?.pitch)}°</Text>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
@@ -340,22 +524,24 @@ export default function DeviceStatusPage({ devicesAll, serialNumber, onDeviceCha
|
||||
handleControlModal={handleControlModal}
|
||||
isControlled={isControlled}
|
||||
/>
|
||||
<div style={{ marginTop: 12, textAlign: 'center' }}>
|
||||
<Space>
|
||||
<Button type="primary" danger ghost={!isControlled} onClick={() => setIsControlled(!isControlled)}>
|
||||
{isControlled ? '释放控制权限' : '请求控制权限'}
|
||||
</Button>
|
||||
</Space>
|
||||
<div style={{ color: '#64748b', fontSize: 12, marginTop: 8 }}>
|
||||
请连接 Xbox 控制器并按下任意按键以激活
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</Card>
|
||||
)}
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Modal
|
||||
title={modalContent.title}
|
||||
open={isModalOpen}
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<p>{modalContent.content}</p>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
53
src/components/useMqtt.ts
Normal file
53
src/components/useMqtt.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import mqtt, { MqttClient } from 'mqtt';
|
||||
|
||||
interface Options {
|
||||
url: string;
|
||||
topic: string | string[];
|
||||
onMessage: (topic: string, message: string) => void;
|
||||
}
|
||||
|
||||
export function useMqtt({ url, topic, onMessage }: Options) {
|
||||
const clientRef = useRef<MqttClient | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const client = mqtt.connect(url, {
|
||||
reconnectPeriod: 3000,
|
||||
username: 'maibu',
|
||||
password: 'maibu',
|
||||
clean: true,
|
||||
});
|
||||
|
||||
clientRef.current = client;
|
||||
|
||||
client.on('connect', () => {
|
||||
console.log('MQTT connected');
|
||||
client.subscribe(topic);
|
||||
});
|
||||
|
||||
client.on('message', (t, payload) => {
|
||||
onMessage(t, payload.toString());
|
||||
});
|
||||
|
||||
client.on('error', err => {
|
||||
console.error('MQTT error', err);
|
||||
});
|
||||
|
||||
return () => {
|
||||
client.end(true);
|
||||
};
|
||||
}, [url, JSON.stringify(topic)]);
|
||||
|
||||
return clientRef;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 使用 */
|
||||
// useMqtt({
|
||||
// url: 'wss://broker.emqx.io:8084/mqtt',
|
||||
// topic: 'robot/status',
|
||||
// onMessage: (_, message) => {
|
||||
// setMsg(message);
|
||||
// },
|
||||
// });
|
||||
Reference in New Issue
Block a user