update 优化代码格式
This commit is contained in:
parent
b19c2805e1
commit
4310e5e049
@ -8,7 +8,7 @@ export const initSSE = (url: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID
|
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID;
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
error
|
error
|
||||||
|
@ -7,7 +7,7 @@ export const initWebSocket = (url: any) => {
|
|||||||
if (import.meta.env.VITE_APP_WEBSOCKET === 'false') {
|
if (import.meta.env.VITE_APP_WEBSOCKET === 'false') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID
|
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID;
|
||||||
useWebSocket(url, {
|
useWebSocket(url, {
|
||||||
autoReconnect: {
|
autoReconnect: {
|
||||||
// 重连最大次数
|
// 重连最大次数
|
||||||
@ -16,14 +16,14 @@ export const initWebSocket = (url: any) => {
|
|||||||
delay: 1000,
|
delay: 1000,
|
||||||
onFailed() {
|
onFailed() {
|
||||||
console.log('websocket重连失败');
|
console.log('websocket重连失败');
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
heartbeat: {
|
heartbeat: {
|
||||||
message: JSON.stringify({type: 'ping'}),
|
message: JSON.stringify({ type: 'ping' }),
|
||||||
// 发送心跳的间隔
|
// 发送心跳的间隔
|
||||||
interval: 10000,
|
interval: 10000,
|
||||||
// 接收到心跳response的超时时间
|
// 接收到心跳response的超时时间
|
||||||
pongTimeout: 2000,
|
pongTimeout: 2000
|
||||||
},
|
},
|
||||||
onConnected() {
|
onConnected() {
|
||||||
console.log('websocket已经连接');
|
console.log('websocket已经连接');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user