Implemented secure WebSocket connection based on the current protocol.
This commit is contained in:
+2
-1
@@ -1,4 +1,5 @@
|
||||
const socket = new WebSocket(`ws://${window.location.host}`);
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const socket = new WebSocket(`${protocol}//${window.location.host}`);
|
||||
|
||||
socket.addEventListener('open', () => {
|
||||
console.log('WebSocket connection established');
|
||||
|
||||
Reference in New Issue
Block a user