From ad5777ad0e998c0dd026053fd02beb20e06a697d Mon Sep 17 00:00:00 2001 From: nestoralonso Date: Sat, 3 Oct 2020 10:04:22 -0500 Subject: [PATCH] Delete WsUtil.js Delete uppercase variant of WsUtils.js because there is an identical version of the file with camelcase name wsUtils.js and some operating systems don't allow that --- web/src/common/WsUtil.js | 42 ---------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 web/src/common/WsUtil.js diff --git a/web/src/common/WsUtil.js b/web/src/common/WsUtil.js deleted file mode 100644 index eb94b59f0..000000000 --- a/web/src/common/WsUtil.js +++ /dev/null @@ -1,42 +0,0 @@ -/* -* Utility for websocket -* -*/ -import { message } from 'antd'; - -/** -* Initiate a ws connection. -* The default path `do-not-proxy` means the ws do not need to be proxied. -* This is very important for AnyProxy‘s own server, such as WEB UI, -* and the websocket detail panel in it, to prevent a recursive proxy. -* @param {wsPort} wsPort the port of websocket -* @param {key} path the path of the ws url -* -*/ -export function initWs(wsPort = location.port, path = 'do-not-proxy') { - if(!WebSocket){ - throw (new Error('WebSocket is not supported on this browser')); - } - - const wsClient = new WebSocket(`ws://${location.hostname}:${wsPort}/${path}`); - - wsClient.onerror = (error) => { - console.error(error); - message.error('error happened when setup websocket'); - }; - - wsClient.onopen = (e) => { - console.info('websocket opened: ', e); - }; - - wsClient.onclose = (e) => { - console.info('websocket closed: ', e); - }; - - return wsClient; -} - -export default { - initWs: initWs -}; -