tangmingyou 3 years ago
parent
commit
22349b1e2f
  1. 4
      config/dev.js
  2. 3
      src/api/websocket.js

4
config/dev.js

@ -10,8 +10,8 @@ module.exports = {
h5: { h5: {
devServer: { devServer: {
//host: '0.0.0.0', //host: '0.0.0.0',
// host: '192.168.110.53', host: '192.168.110.53',
host: '192.168.3.104', // host: '192.168.3.104',
port: 10086, port: 10086,
// 设置代理来解决 H5 请求的跨域问题 // 设置代理来解决 H5 请求的跨域问题
proxy: { proxy: {

3
src/api/websocket.js

@ -42,7 +42,6 @@ const websocket = {
this.conn.close(); this.conn.close();
} }
this.conn = ws this.conn = ws
console.log(this)
ws.binaryType = 'arraybuffer' ws.binaryType = 'arraybuffer'
ws.onopen = (e) => { ws.onopen = (e) => {
// 关闭定时重连 // 关闭定时重连
@ -192,7 +191,7 @@ export const addMsgListen = (type, call) => {
websocket.waitInitCalls.push(() => addMsgListen(type, call)); websocket.waitInitCalls.push(() => addMsgListen(type, call));
return; return;
} }
console.log('add listen...', type) // console.log('add listen...', type)
const op = websocket.nameOpMap[type]; const op = websocket.nameOpMap[type];
if (op === undefined) { if (op === undefined) {
console.error(`not found listen msg type [${type}] for all type:`, websocket.nameOpMap); console.error(`not found listen msg type [${type}] for all type:`, websocket.nameOpMap);

Loading…
Cancel
Save