url of created websocket is just 'ws://' despite of passed url
Opened this issue · 1 comments
I pass next url to create websocket client and server: ws://localhost/abs/abs
.
When checking created websocket instance I see that webSocket.url equals just ws://
.
This problem is really annoying when you have 2 websocket instances: even if we pass 2 different urls to WebSocket constructor, both of them will be equal to ws://
, as a result if I add message
event listener using addEventListener
to websocket, that was created first, when 2nd websocket is created, this message
event listener will be called never.
I managed to fix bug with websocket client/server url when I commented out urlParse
code and just store passed url into this.url on Client and Server classes, so insead of
class Server extends EventTarget {
constructor(url, options = {}) {
super();
const urlRecord = new URL(url);
if (!urlRecord.pathname) {
urlRecord.pathname = '/';
}
this.url = urlRecord.toString();
I use:
class Server extends EventTarget {
constructor(url, options = {}) {
super();
this.url = url;
(The same for Client class)
Is it still reproducible?