mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
using WSS protocol when on HTTPS instead of WS
This commit is contained in:
parent
15faefe8a3
commit
28bc443914
@ -39,9 +39,11 @@ const messaging = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connectWebSocket() {
|
function connectWebSocket() {
|
||||||
|
const protocol = document.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||||
|
|
||||||
// use wss for secure messaging
|
// use wss for secure messaging
|
||||||
ws = new WebSocket("ws://" + location.host);
|
ws = new WebSocket(protocol + "://" + location.host);
|
||||||
ws.onopen = function (event) {};
|
ws.onopen = event => console.log("Connected to server with WebSocket");
|
||||||
ws.onmessage = messageHandler;
|
ws.onmessage = messageHandler;
|
||||||
ws.onclose = function(){
|
ws.onclose = function(){
|
||||||
// Try to reconnect in 5 seconds
|
// Try to reconnect in 5 seconds
|
||||||
|
Loading…
x
Reference in New Issue
Block a user