Switch to secure ws connections when possible (#1380)

This commit is contained in:
Navaneeth Pk 2021-11-05 19:05:08 +05:30 committed by GitHub
parent acdef10b05
commit 583bc6ea7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,7 +116,7 @@ class Editor extends React.Component {
initWebSocket = () => {
// TODO: add retry policy
const socket = new WebSocket(`ws://${this.getWebsocketUrl()}`);
const socket = new WebSocket(`${window.location.protocol === 'https:' ? 'wss' : 'ws'}://${this.getWebsocketUrl()}`);
// Connection opened
socket.addEventListener('open', function (event) {