|
@@ -1,3 +1,4 @@
|
|
|
|
+const _ = require('lodash')
|
|
import { ws } from '@/apiConfig/requestIP'
|
|
import { ws } from '@/apiConfig/requestIP'
|
|
export default {
|
|
export default {
|
|
name: 'test',
|
|
name: 'test',
|
|
@@ -24,9 +25,10 @@ export default {
|
|
websocketonopen() { // 连接建立之后执行send方法发送数据
|
|
websocketonopen() { // 连接建立之后执行send方法发送数据
|
|
|
|
|
|
},
|
|
},
|
|
- websocketonerror() { // 连接建立失败重连
|
|
|
|
|
|
+ websocketonerror: _.throttle(function() { // 连接建立失败重连
|
|
|
|
+ console.log(222)
|
|
this.initWebSocket()
|
|
this.initWebSocket()
|
|
- },
|
|
|
|
|
|
+ }, 5000),
|
|
websocketsend(Data) { // 数据发送
|
|
websocketsend(Data) { // 数据发送
|
|
this.websock.send(Data)
|
|
this.websock.send(Data)
|
|
},
|
|
},
|