zhongrj
2025-03-28 4ff3eee77b41466d08117970970d01be6e48ffe1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * @Author: GuLiMmo 2820890765@qq.com
 * @Date: 2024-03-12 18:01:28
 * @LastEditors: GuLiMmo 2820890765@qq.com
 * @LastEditTime: 2024-08-27 16:10:38
 * @FilePath: /drone-web/src/websocket/util/config.ts
 * @Description:
 * Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
 */
import { ELocalStorageKey } from '@/types/enums'
import { CURRENT_CONFIG } from '@/api/http/config'
 
const user = localStorage.getItem('user_info')
export function getWebsocketUrl () {
  const token: string = localStorage.getItem(ELocalStorageKey.Token) || '' as string
  // const url = CURRENT_CONFIG.websocketURL
  // const url = (window?.globalApiConfig?.baseUrl?.wsBaseUrl || import.meta.env.VITE_WS_API_URL) + '?x-auth-token=' + encodeURI(token)
  // by cpz 20250109
  
  const url = `wss://wrj.shuixiongit.com/drone-wss/api/v1/ws?x-auth-token=${encodeURI(token)}`
  return url
}
 
// // 我们自己的webSocket逻辑
// export function getMyWebSocketUrl () {
//   const obj = JSON.parse(user)
//   const url = CURRENT_CONFIG.websocketURL + '/' + obj.id
//   return url
// }