Merge pull request #45 from fossyy/staging

Fix WebSocket protocol handling based on page protocol
This commit is contained in:
2024-09-09 21:51:01 +07:00
committed by GitHub

View File

@ -1,6 +1,6 @@
if (!window.mySocket) {
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
window.mySocket = new WebSocket(`${wsProtocol}://${window.location.host}/user`);
window.mySocket = new WebSocket(`${wsProtocol}//${window.location.host}/user`);
window.mySocket.onopen = function(event) {
console.log('WebSocket is open now.');