Commit fc4d5caf by MichaelJier

update

1. 新增直播间心跳传输信息
parent a3bfbd96
node_modules
dist
timer.js
\ No newline at end of file
...@@ -57,12 +57,47 @@ export default { ...@@ -57,12 +57,47 @@ export default {
isPeep() { isPeep() {
const peep = this.channelConfig.peep || {}; const peep = this.channelConfig.peep || {};
return !!peep.isEnable; return !!peep.isEnable;
},
token() {
return this.$cookie.get(this.tokenKey) ? this.$cookie.get(this.tokenKey).token || 0 : 0
} }
}, },
async mounted() { async mounted() {
this.$Bus.$on('bus-showLogin', this._toggleLogin); this.$Bus.$on('bus-showLogin', this._toggleLogin);
this.get_userInfo({ refererId: this.$route.query.refererId }); await this.get_userInfo({ refererId: this.$route.query.refererId });
this.set_nowDate(); this.set_nowDate();
const websocketHeartbeat = require('@/plugins/timer').default;
this.timer = websocketHeartbeat({
url: 'ws://47.110.242.138:8081/stats/channel/watchTime',
pingTimeout: 5000,
pongTimeout: 5000,
manualStart: false,
repeatLimit: 3,
userInfo: {
"msg": "",
"token": this.token,
"id": this.channelInfo.id,
"type":"live",
"uin": this.channelInfo.uin,
"liveNowStatus": this.channelInfo.liveNowStatus
},
webworker: true
}).useIt('uuid').useIt('ua')
// this.$watch(
// () => {
// return this.$cookie.get(this.tokenKey) ? this.$cookie.get(this.tokenKey).token || 0 : 0
// },
// function(oldVal,newVal){
// console.log(oldVal, newVal)
// }
// )
// 进入5s开始连接
setTimeout(() => {
this.timer.createWebSocket()
})
this.timer.onMessage = function (e) {
console.log(`onmessage: ${e.data}`)
}
}, },
methods: { methods: {
...mapActions({ ...mapActions({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment