From c55e85b448fbfe77a894928bbff9f5d2c8c5670c Mon Sep 17 00:00:00 2001 From: "453530270@qq.com" Date: Thu, 27 Jul 2023 17:37:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=94=A8=E8=8E=B7=E5=8F=96ws=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/comm.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/utils/comm.js b/src/utils/comm.js index ba372b6..ba4fb6e 100644 --- a/src/utils/comm.js +++ b/src/utils/comm.js @@ -32,4 +32,16 @@ export function ecMaxVal(arr){ narr[i]=maxval+267 } return narr; +} + +// websoket +// 查询的参数封装成json +export function rtsocket(param){ + ws = new WebSocket("ws://10.97.121.2/ws"); + ws.onopen = function() { + ws.send(JSON.stringify(param)) + }; + ws.onmessage = function(e) { + return e.data; + }; } \ No newline at end of file