|
@@ -117,6 +117,7 @@ class Index extends Component {
|
|
|
}
|
|
|
|
|
|
initSocket () {
|
|
|
+ const { uObj } = this.state
|
|
|
const that = this
|
|
|
Taro.connectSocket({
|
|
|
url: 'ws://192.168.101.147:8089/acc',
|
|
@@ -126,9 +127,9 @@ class Index extends Component {
|
|
|
}).then(task => {
|
|
|
task.onOpen(function () {
|
|
|
// console.log('onOpen')
|
|
|
- const { to_user_id } = that.$router.params
|
|
|
+ // const { to_user_id } = that.$router.params
|
|
|
let token = Taro.getStorageSync('APP_token')
|
|
|
- task.send({ data: '{"seq":"' + that.sendId() + '","cmd":"login","data":{"userId":"' + to_user_id + '","appId":101,"serviceToken":"' + token + '"}}' })
|
|
|
+ task.send({ data: '{"seq":"' + that.sendId() + '","cmd":"login","data":{"userId":"' + uObj.user_id + '","appId":101,"serviceToken":"' + token + '"}}' })
|
|
|
setInterval(() => {
|
|
|
task.send({data: '{"seq":"' + that.sendId() + '","cmd":"heartbeat","data":{}}'});
|
|
|
}, 30000)
|