socket修改
This commit is contained in:
parent
40331ae769
commit
f6d91a08f6
@ -176,6 +176,8 @@ export default {
|
|||||||
sessionStorage.setItem('userInfo', JSON.stringify(res.user))
|
sessionStorage.setItem('userInfo', JSON.stringify(res.user))
|
||||||
this.$store.commit('setUserInfo', res.user)
|
this.$store.commit('setUserInfo', res.user)
|
||||||
|
|
||||||
|
let socketUrl = `wss://mediate.dev.trydotec.com/mediate/ws/websocket`;
|
||||||
|
this.$stompSocket.initStomp(socketUrl,a => this.socketSucc(a), b => this.socketErr(b));
|
||||||
if (res.user.resources.length > 0) {
|
if (res.user.resources.length > 0) {
|
||||||
let url = "/workbench";
|
let url = "/workbench";
|
||||||
// let data= res.user.resources[0].children[0]
|
// let data= res.user.resources[0].children[0]
|
||||||
@ -186,7 +188,6 @@ export default {
|
|||||||
// }
|
// }
|
||||||
this.$store.commit('setRoutes', url)
|
this.$store.commit('setRoutes', url)
|
||||||
this.$router.push(url)
|
this.$router.push(url)
|
||||||
this.$stompSocket.initStomp(a => this.socketSucc(a), b => this.socketErr(b));
|
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning('未赋予数据权限!')
|
this.$message.warning('未赋予数据权限!')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import {Client,Message }from '@stomp/stompjs';
|
import {Client,Message }from '@stomp/stompjs';
|
||||||
|
|
||||||
let client = null;
|
let client = null;
|
||||||
let url = 'wss://mediate.dev.trydotec.com/mediate/ws/websocket';
|
// let url = `wss://mediate.dev.trydotec.com/mediate/ws/websocket`;
|
||||||
let subscriptionMap = {};
|
let subscriptionMap = {};
|
||||||
|
|
||||||
const socketClass = {
|
const socketClass = {
|
||||||
// 初始化
|
// 初始化
|
||||||
initStomp(succ, err) {
|
initStomp(url, succ, err) {
|
||||||
console.log('----过来了')
|
// console.log('----过来了')
|
||||||
client = new Client({
|
client = new Client({
|
||||||
brokerURL: url,
|
brokerURL: url,
|
||||||
debug: function (str) {
|
debug: function (str) {
|
||||||
@ -29,7 +29,7 @@ const socketClass = {
|
|||||||
publish(data) {
|
publish(data) {
|
||||||
// data
|
// data
|
||||||
// {
|
// {
|
||||||
// destination: '/topic/general',
|
// destination: '/topic/video-room/{roomid}',
|
||||||
// body: 'Hello world',
|
// body: 'Hello world',
|
||||||
// headers: { priority: '9' },
|
// headers: { priority: '9' },
|
||||||
// }
|
// }
|
||||||
@ -38,6 +38,7 @@ const socketClass = {
|
|||||||
},
|
},
|
||||||
// 订阅
|
// 订阅
|
||||||
subscription(url, callback) {
|
subscription(url, callback) {
|
||||||
|
// url: /topic/video-room/{roomid}
|
||||||
// callback = function (message) {
|
// callback = function (message) {
|
||||||
// // called when the client receives a STOMP message from the server
|
// // called when the client receives a STOMP message from the server
|
||||||
// if (message.body) {
|
// if (message.body) {
|
||||||
@ -51,6 +52,7 @@ const socketClass = {
|
|||||||
},
|
},
|
||||||
// 取消订阅
|
// 取消订阅
|
||||||
unsubscribe(url) {
|
unsubscribe(url) {
|
||||||
|
// url: /topic/video-room/{roomid}
|
||||||
if (!client)return;
|
if (!client)return;
|
||||||
if (url){
|
if (url){
|
||||||
const a = subscriptionMap[url];
|
const a = subscriptionMap[url];
|
||||||
|
|||||||
1
src/utils/tcccVoiceCall.js
Normal file
1
src/utils/tcccVoiceCall.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
import fetchApi from "@/services/fetchApi";
|
||||||
Loading…
x
Reference in New Issue
Block a user