shikeying
2023-04-19 529f48641122af7c0aec185e4283d02e97aa0f89
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import WebConnection from "@/utils/webconnection";
 
/**
 * 该对象废弃,放到:user组件中了
 * @type {{mutations: {SET_CONNECTION: websocket.mutations.SET_CONNECTION, SET_WS_MSG: websocket.mutations.SET_WS_MSG}, state: {webConnection: null, webSocketMsg: null}, actions: {CreateWebConnection({commit: *}, *): void}}}
 */
const websocket = {
  state: {
    webConnection: null,
    webSocketMsg: null
  },
 
  mutations: {
    SET_CONNECTION: (state, data) => {
      // var webConnection = new WebConnection();
      WebConnection.setInfo(data.uri, data.uid);
      state.webConnection = WebConnection;
    },
    SET_WS_MSG: (state, data)=>{
      state.webSocketMsg = data;
    }
  },
 
  actions: {
    CreateWebConnection({ commit }, data){
      commit('SET_CONNECTION', data);
    }
  }
}
 
export default websocket