Skip to content

Commit c5ae9da

Browse files
authored
Merge branch 'master' into dev
2 parents c80e8fd + 1af6e9d commit c5ae9da

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

services/api/socket.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** Services */
2-
import { Server } from "../config"
2+
import { useSocketURL } from "../config"
33

44
/** Store */
55
import { useAppStore } from "@/store/app"
@@ -9,7 +9,7 @@ export let socket = null
99
export const init = () => {
1010
const appStore = useAppStore()
1111

12-
socket = new WebSocket(Server.WSS)
12+
socket = new WebSocket(useSocketURL())
1313

1414
socket.addEventListener("open", (e) => {
1515
/** Head Subscription */

services/config.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ export const Server = {
44
mocha: "https://api-mocha-4.celenium.io/v1",
55
dev: "https://api-dev.celenium.io/v1",
66
},
7-
WSS: "wss://api-dev.celenium.io/v1/ws",
7+
WSS: {
8+
mainnet: "wss://api.celenium.io/v1/ws",
9+
mocha: "wss://api-dev.celenium.io/v1/ws",
10+
dev: "wss://api-dev.celenium.io/v1/ws",
11+
},
812
}
913

1014
export const useServerURL = () => {
@@ -17,10 +21,34 @@ export const useServerURL = () => {
1721
case "mocha-4.celenium.io":
1822
return Server.API.mocha
1923

24+
case "mocha.celenium.io":
25+
return Server.API.mocha
26+
2027
case "dev.celenium.io":
2128
return Server.API.dev
2229

2330
default:
2431
return Server.API.dev
2532
}
2633
}
34+
35+
export const useSocketURL = () => {
36+
const requestURL = useRequestURL()
37+
38+
switch (requestURL.hostname) {
39+
case "celenium.io":
40+
return Server.WSS.mainnet
41+
42+
case "mocha-4.celenium.io":
43+
return Server.WSS.mocha
44+
45+
case "mocha.celenium.io":
46+
return Server.WSS.mocha
47+
48+
case "dev.celenium.io":
49+
return Server.WSS.dev
50+
51+
default:
52+
return Server.WSS.dev
53+
}
54+
}

services/utils/general.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ export const getNetworkName = () => {
5050
case "mocha-4.celenium.io":
5151
return "Mocha-4"
5252

53+
case "mocha.celenium.io":
54+
return "Mocha-4"
55+
5356
case "dev.celenium.io":
5457
return "Development"
5558

0 commit comments

Comments
 (0)