zs 2 years ago
parent
commit
5b35344a31
1 changed files with 9 additions and 2 deletions
  1. 9 2
      store/websocketStore.js

+ 9 - 2
store/websocketStore.js

@@ -28,8 +28,15 @@ const store = new Vuex.Store({
 			})
 			state.socketTask.onOpen(() => dispatch('websocketOnOpen'))
 			state.socketTask.onMessage(res => dispatch('websocketOnMessage', res))
-			state.socketTask.onClose(e => dispatch('websocketOnClose'))
-			state.socketTask.onError(e => dispatch('websocketOnError'))
+			state.socketTask.onClose(res => {
+				state.socketTask == null
+				console.log('WebSocket连接关闭')
+			});
+			state.socketTask.onError(res => {
+				state.socketTask == null
+				console.log('WebSocket连接错误')
+			});
+
 		},
 		websocketOnOpen({
 			commit