Warn when trying to connect to bad urls

This commit is contained in:
Jon Staab
2024-11-08 14:35:26 -08:00
parent 8b320e7c9f
commit 07b439eef2
4 changed files with 15 additions and 4 deletions
+5
View File
@@ -1,4 +1,5 @@
import {Emitter} from '@welshman/lib'
import {normalizeRelayUrl} from '@welshman/util'
import {Socket} from './Socket'
import type {Message} from './Socket'
import {ConnectionEvent} from './ConnectionEvent'
@@ -27,6 +28,10 @@ export class Connection extends Emitter {
constructor(url: string) {
super()
if (url !== normalizeRelayUrl(url)) {
console.warn(`Attempted to open connection to non-normalized url ${url}`)
}
this.url = url
this.socket = new Socket(this)
this.sender = new ConnectionSender(this)