Skip to content

Commit 7607898

Browse files
committed
adapt ws scheme
1 parent a2a8c2c commit 7607898

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

OpenFlow/src/WebServer.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ export class WebServer {
8787
}
8888
server = https.createServer(options, this.app);
8989

90-
91-
var _http = http.createServer(this.app);
92-
_http.listen(80);
93-
9490
// var redirapp = express();
9591
// var _http = http.createServer(redirapp);
9692
// redirapp.get('*', function (req, res) {

OpenFlow/src/public/WebSocketClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ module openflow {
168168
}
169169
init() {
170170
this.getJSON("/config", async (error: any, data: any) => {
171+
if (location.protocol == 'https:' && data.wshost.startsWith("ws://")) {
172+
data.wshost = data.wshost.replace("ws://", "wss://");
173+
}
174+
if (location.protocol == 'http:' && data.wshost.startsWith("wss://")) {
175+
data.wshost = data.wshost.replace("wss://", "ws://");
176+
}
171177
console.debug("WebSocketClient::onopen: connecting to " + data.wshost);
172178
this._socketObject = new ReconnectingWebSocket(data.wshost);
173179
this._socketObject.onopen = (this.onopen).bind(this);

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.163
1+
0.0.164

0 commit comments

Comments
 (0)