@soundworks/core 4.0.0-alpha.23 → 4.0.0-alpha.24
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/client/Socket.js +15 -0
- package/src/common/version.js +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/client/Socket.js
CHANGED
|
@@ -61,13 +61,27 @@ class Socket {
|
|
|
61
61
|
let webSocketOptions;
|
|
62
62
|
|
|
63
63
|
if (isBrowser()) {
|
|
64
|
+
const hostname = window.location.hostname;
|
|
64
65
|
// if a server address is given in config, use it, else fallback to URL hostname
|
|
65
66
|
if (config.env.serverAddress !== '') {
|
|
66
67
|
serverAddress = config.env.serverAddress;
|
|
67
68
|
} else {
|
|
69
|
+
serverAddress = hostname;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// when in https with self-signed certificates, we don't want to use
|
|
73
|
+
// the serverAddress defined in config as the socket would be blocked, so we
|
|
74
|
+
// just override serverAddress with hostname in this case
|
|
75
|
+
const localhosts = ['127.0.0.1', 'localhost'];
|
|
76
|
+
|
|
77
|
+
if (config.env.useHttps && localhosts.includes(hostname)) {
|
|
68
78
|
serverAddress = window.location.hostname;
|
|
69
79
|
}
|
|
70
80
|
|
|
81
|
+
if (config.env.useHttps && window.location.hostname !== serverAddress) {
|
|
82
|
+
console.warn(`The WebSocket will try to connect at ${serverAddress} as defined in environment configuration while the page is accessed from ${hostname}. If you run the application with self-signed certificates, this can lead to socket errors as the certificate may not have been accepted for ${serverAddress}. In such case you should rather access the page from ${serverAddress}.`);
|
|
83
|
+
}
|
|
84
|
+
|
|
71
85
|
webSocketOptions = [];
|
|
72
86
|
} else {
|
|
73
87
|
serverAddress = config.env.serverAddress;
|
|
@@ -155,6 +169,7 @@ class Socket {
|
|
|
155
169
|
// we want to log the warning just once
|
|
156
170
|
if (!connectionRefusedLogged) {
|
|
157
171
|
logger.log('[soundworks.Socket] Connection refused, waiting for the server to start');
|
|
172
|
+
console.log(e.error);
|
|
158
173
|
connectionRefusedLogged = true;
|
|
159
174
|
}
|
|
160
175
|
|
package/src/common/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// [WARNING] This file is generated, do not edit
|
|
2
|
-
export default '4.0.0-alpha.
|
|
2
|
+
export default '4.0.0-alpha.24';
|