Skip to content

Commit 654f9e2

Browse files
committed
fixed a url fragment issue with web socket url on page load for room hashes
There is an issue on page load when you have a room hash in the url. You get a url fragment error and the socket connection does not succeed
1 parent 5864d2b commit 654f9e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

example/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,10 @@
196196

197197

198198
var room = window.location.hash.slice(1);
199-
200-
rtc.connect("ws:" + window.location.href.substring(window.location.protocol.length), room);
199+
var url = "ws:"+window.location.href.substring(window.location.protocol.length);
200+
var hash = url.indexOf('#');
201+
url = (hash !== -1) ? url.substring(0, hash) : url;
202+
rtc.connect(url, room);
201203

202204
rtc.on('add remote stream', function(stream, socketId) {
203205
console.log("ADDING REMOTE STREAM...");

0 commit comments

Comments
 (0)