@symbo.ls/socket 2.27.8 → 2.27.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.js +12 -7
- package/package.json +4 -4
package/client.js
CHANGED
|
@@ -11,10 +11,12 @@ const defautlOpts = {}
|
|
|
11
11
|
let CONNECT_ATTEPT = 0
|
|
12
12
|
const CONNECT_ATTEPT_MAX_ALLOWED = 1
|
|
13
13
|
|
|
14
|
-
const getIsDev =
|
|
15
|
-
return
|
|
14
|
+
const getIsDev = options => {
|
|
15
|
+
return (
|
|
16
|
+
options.development ||
|
|
16
17
|
(window && window.location && window.location.host.includes('local')) ||
|
|
17
|
-
(ENV
|
|
18
|
+
isNotProduction(ENV)
|
|
19
|
+
)
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
const getSocketUrl = (options, isDev) => {
|
|
@@ -64,7 +66,7 @@ export const connect = (key, options = {}) => {
|
|
|
64
66
|
}
|
|
65
67
|
})
|
|
66
68
|
|
|
67
|
-
socket.on('connect_error',
|
|
69
|
+
socket.on('connect_error', err => {
|
|
68
70
|
console.log(`event: connect_error | reason: ${err.message}`)
|
|
69
71
|
try {
|
|
70
72
|
if (isFunction(options.onError)) options.onError(err, socket)
|
|
@@ -74,9 +76,12 @@ export const connect = (key, options = {}) => {
|
|
|
74
76
|
|
|
75
77
|
socket.disconnect()
|
|
76
78
|
|
|
77
|
-
if (ENV
|
|
79
|
+
if (utils.isNotProduction(ENV)) {
|
|
78
80
|
console.log(
|
|
79
|
-
'Could not connect to %c' +
|
|
81
|
+
'Could not connect to %c' +
|
|
82
|
+
primaryUrl +
|
|
83
|
+
'%c, reconnecting to %c' +
|
|
84
|
+
secondaryUrl,
|
|
80
85
|
'font-weight: bold; color: red;',
|
|
81
86
|
'',
|
|
82
87
|
'font-weight: bold; color: green;'
|
|
@@ -90,7 +95,7 @@ export const connect = (key, options = {}) => {
|
|
|
90
95
|
}
|
|
91
96
|
})
|
|
92
97
|
|
|
93
|
-
socket.on('disconnect',
|
|
98
|
+
socket.on('disconnect', reason => {
|
|
94
99
|
console.log(`event: disconnect | reason: ${reason}`)
|
|
95
100
|
try {
|
|
96
101
|
if (isFunction(options.onDisconnect)) options.onDisconnect(reason, socket)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/socket",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.11",
|
|
4
4
|
"description": "Connect your app to Symbols editor",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"author": "symbo.ls",
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"start": "nodemon server.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@domql/utils": "^2.27.
|
|
14
|
-
"@symbo.ls/init": "^2.27.
|
|
13
|
+
"@domql/utils": "^2.27.11",
|
|
14
|
+
"@symbo.ls/init": "^2.27.11",
|
|
15
15
|
"chalk": "^5.4.1",
|
|
16
16
|
"express": "^4.21.2",
|
|
17
17
|
"http": "^0.0.1-security",
|
|
18
18
|
"socket.io": "^4.8.1",
|
|
19
19
|
"socket.io-client": "^4.8.1"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "0189e4620f901c763754d06de65bcf6075c05618"
|
|
22
22
|
}
|