ezhizao_zx 3 сар өмнө
parent
commit
d0559d16ac

+ 2 - 2
src/store/modules/message.js

@@ -1,7 +1,7 @@
-import { getWsUrl } from "../../utils/ws"
+import { patternNginxWsUrl } from "../../utils/ws"
 
 // const webSocket = require('ws')
-const wsUrl = getWsUrl()
+const wsUrl = patternNginxWsUrl()
 
 const useMessageStore = defineStore('message', {
   status: () => ({

+ 15 - 13
src/utils/ws.js

@@ -24,20 +24,22 @@ export function getWsExportUrl() {
 
 export function patternNginxWsUrl() {
   var itemUrl = document.location.origin;
-  console.log(itemUrl)
-  if (itemUrl.includes(hostIp)) {
-    return "ws://" + hostIp + "/ws/"
-  } else {
-    return "ws://120.46.159.163/ws/"
-  }
+  // console.log(itemUrl)
+  // if (itemUrl.includes(hostIp)) {
+  //   return "ws://" + hostIp + "/ws/"
+  // } else {
+  //   return "ws://120.46.159.163/ws/"
+  // }
+  return itemUrl.replace('http', 'ws') + '/ws/'
 }
 
 export function patternNginxExportWsUrl() {
-  var itemUrl = document.location.origin;
-  console.log(itemUrl)
-  if (itemUrl.includes(hostIp)) {
-    return "ws://" + hostIp + "/ws/"
-  } else {
-    return "ws://120.46.159.163/ws/"
-  }
+  // var itemUrl = document.location.origin;
+  // console.log(itemUrl)
+  // if (itemUrl.includes(hostIp)) {
+  //   return "ws://" + hostIp + "/ws/"
+  // } else {
+  //   return "ws://120.46.159.163/ws/"
+  // }
+  return itemUrl.replace('http', 'ws') + '/ws-production/'
 }