You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
bondom
changed the title
url of created websocket is just 'ws://'
url of created websocket is just 'ws://' despite of passed url
Nov 11, 2020
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 addmessage
event listener usingaddEventListener
to websocket, that was created first, when 2nd websocket is created, thismessage
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 ofI use:
(The same for Client class)
The text was updated successfully, but these errors were encountered: