From 29c3e23510bcef421f64f909064ff50be4512fd1 Mon Sep 17 00:00:00 2001 From: Richard Allaway Date: Fri, 24 Aug 2018 15:37:35 -0400 Subject: [PATCH] fix(serve): use wss protocol for secure websocket when page is using https (#1358) --- bin/ion-dev.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/ion-dev.js b/bin/ion-dev.js index c07ee04a..e8643459 100644 --- a/bin/ion-dev.js +++ b/bin/ion-dev.js @@ -98,7 +98,8 @@ window.IonicDevServer = { openConnection: function() { var self = this; - this.socket = new WebSocket('ws://' + window.location.hostname + ':' + IonicDevServerConfig.wsPort); + var socketProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; + this.socket = new WebSocket(socketProtocol + '//' + window.location.hostname + ':' + IonicDevServerConfig.wsPort); this.socket.onopen = function(ev) { self.socketReady = true;