Warn when trying to connect to bad urls
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user