|
@@ -41,6 +41,8 @@ const store = new Vuex.Store({
|
|
|
vuex_socket: null,
|
|
|
vuex_wsMessageData: '',
|
|
|
vuex_heartInterId: null,
|
|
|
+ // 设备信息
|
|
|
+ vuex_bizId: '1646545', // 编号
|
|
|
},
|
|
|
mutations: {
|
|
|
$uStore(state, payload) {
|
|
@@ -69,8 +71,7 @@ const store = new Vuex.Store({
|
|
|
let token = getApp().globalData.token
|
|
|
let url = getApp().globalData.baseUrl
|
|
|
let wsBaseUrl = url.indexOf("https:")>=0 ? url.replace("https:","wss:") : url.replace("http:","ws:")
|
|
|
- let wsUrl = wsBaseUrl + 'websocket/16546'
|
|
|
- console.log(token,wsUrl)
|
|
|
+ let wsUrl = wsBaseUrl + 'websocket/weixin/' + state.vuex_bizId
|
|
|
// 开始连接
|
|
|
state.vuex_socket = uni.connectSocket({
|
|
|
header: {'X-AUTH-TOKEN':token},
|
|
@@ -95,7 +96,7 @@ const store = new Vuex.Store({
|
|
|
state.vuex_socket.onMessage(function(e){
|
|
|
if (e.data != 'pong'){
|
|
|
let ret = JSON.parse(e.data)
|
|
|
- console.log('ws接收!', ret)
|
|
|
+ console.log('ws接收消息!', ret)
|
|
|
state.vuex_wsMessageData = ret
|
|
|
}
|
|
|
})
|