Skip to content

Commit

Permalink
fix: prefix peer addresses with protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Dec 24, 2024
1 parent d386096 commit efd4730
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/backend/src/modules/broadcast/connection/CLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ class CLink extends BaseLink {
}

connect () {
const address = this.config.address;
let address = this.config.address;
if ( ! address.startsWith('https://') ) {
address = `https://${address}`;
}
const socket = this.modules.sioclient(address, {
transports: ['websocket'],
path: '/wssinternal',
Expand All @@ -54,7 +57,7 @@ class CLink extends BaseLink {
});
socket.on('connect', () => {
this.log.info(`connected`, {
address: this.config.address
address,
});

const require = this.require;
Expand All @@ -76,12 +79,12 @@ class CLink extends BaseLink {
});
socket.on('disconnect', () => {
this.log.info(`disconnected`, {
address: this.config.address
address,
});
});
socket.on('connect_error', e => {
this.log.info(`connection error`, {
address: this.config.address,
address,
message: e.message,
});
});
Expand Down

0 comments on commit efd4730

Please sign in to comment.