Skip to content

Commit

Permalink
Update messageHandler.js (#21)
Browse files Browse the repository at this point in the history
* Update messageHandler.js

* Update messageHandler.js
  • Loading branch information
isnifer authored Nov 22, 2024
1 parent 489831c commit 6bb2cc1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/core/js/common/components/messageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ export class MessageHandler {
}

export function initializeWebSocket(clientId) {
const protocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
const serverAddress = `${window.location.hostname}:${window.location.port}`;
const messageHandler = new MessageHandler();
const wsHandler = new WebSocketHandler(
`ws://${serverAddress}/ws?clientId=${encodeURIComponent(clientId)}`,
`${protocol}://${serverAddress}/ws?clientId=${encodeURIComponent(clientId)}`,
(event) => messageHandler.handleMessage(event)
);
wsHandler.connect();
Expand Down

0 comments on commit 6bb2cc1

Please sign in to comment.