Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 29c3e23

Browse files
rallimhoffd
authored andcommitted
fix(serve): use wss protocol for secure websocket when page is using https (#1358)
1 parent 1e2035e commit 29c3e23

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bin/ion-dev.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ window.IonicDevServer = {
9898

9999
openConnection: function() {
100100
var self = this;
101-
this.socket = new WebSocket('ws://' + window.location.hostname + ':' + IonicDevServerConfig.wsPort);
101+
var socketProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
102+
this.socket = new WebSocket(socketProtocol + '//' + window.location.hostname + ':' + IonicDevServerConfig.wsPort);
102103

103104
this.socket.onopen = function(ev) {
104105
self.socketReady = true;

0 commit comments

Comments
 (0)