Skip to content

Commit b8aa45e

Browse files
committed
web socket protocol initialization fix
1 parent 370070b commit b8aa45e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

chat/js/client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Class.Define('Chat', {
22
Static: {
3-
ADDRESS: 'ws://%location.host%%location.pathname%data/'
3+
ADDRESS: '%websocket.protocol%//%location.host%%location.pathname%data/'
44
},
55
Constructor: function () {
66
this._initElements();
@@ -110,6 +110,7 @@ Class.Define('Chat', {
110110
// connect to server:
111111
this._socket = SocketWrapper.getInstance(
112112
this.self.ADDRESS
113+
.replace('%websocket.protocol%', location.protocol === 'https:' ? 'wss:' : 'ws:')
113114
.replace('%location.host%', location.host)
114115
.replace('%location.pathname%', location.pathname)
115116
);

0 commit comments

Comments
 (0)