#
Junjie
2024-06-22 5668915db03b392e5ab2a312965db85e9e79cf36
#
2个文件已修改
20 ■■■■ 已修改文件
zy-asrs-flow/src/pages/device/lift/index.jsx 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/device/shuttle/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/device/lift/index.jsx
@@ -6,6 +6,7 @@
    PageContainer,
} from '@ant-design/pro-components';
import './index.less'
import { WEBSOCKET_BASE_URL } from '@/config/setting';
const Main = () => {
    const [deviceInfos, setDeviceInfos] = useState([]);
@@ -16,8 +17,7 @@
    const [mapLev, setMapLev] = useState([]);
    useEffect(() => {
        var newWs = new WebSocket("ws://127.0.0.1:9090/wcs/ws/lift/websocket");
        setWs(newWs);
        connect();
        getMapLev();
@@ -55,6 +55,7 @@
            ws.onclose = function (e) {
                console.log("close");
                reconnect();
            }
            ws.onerror = function (e) {
@@ -63,6 +64,18 @@
        }
    }, [ws]);
    const connect = () => {
        var newWs = new WebSocket(WEBSOCKET_BASE_URL + "/ws/lift/websocket");
        setWs(newWs);
    }
    const reconnect = () => {
        setTimeout(() => {
            console.log('WebSocketClient: Attempting to reconnect...');
            connect();
        }, 3000);
    }
    const sendWs = (message) => {
        if (ws.readyState == WebSocket.OPEN) {
            ws.send(message)
zy-asrs-flow/src/pages/device/shuttle/index.jsx
@@ -6,6 +6,7 @@
    PageContainer,
} from '@ant-design/pro-components';
import './index.less'
import { WEBSOCKET_BASE_URL } from '@/config/setting';
const Main = () => {
    const [deviceInfos, setDeviceInfos] = useState([]);
@@ -67,7 +68,7 @@
    }, [ws]);
    const connect = () => {
        var newWs = new WebSocket("ws://127.0.0.1:9090/wcs/ws/shuttle/websocket");
        var newWs = new WebSocket(WEBSOCKET_BASE_URL + "/ws/shuttle/websocket");
        setWs(newWs);
    }