Skip to content

Commit

Permalink
Make spaces work on the client side
Browse files Browse the repository at this point in the history
I made a mistake when rewriting tawk to use Janus:
the "space" is the first part of the path, not the second.
In addition, you should only subscribe to video streams
from your space
  • Loading branch information
karth295 committed May 22, 2016
1 parent 208500b commit 4983282
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
return DIV {}, 'Loading...'
active_connections = 0
for conn in connections.all
if conn.group != null and conn.app == 'talkspace' and conn.space == window.location.pathname.split('/')[2]
if conn.group != null and conn.app == 'talkspace' and conn.space == window.location.pathname.split('/')[1]
active_connections += 1

my_conn = fetch('/connection')
Expand All @@ -34,7 +34,7 @@
me.group = (if active_connections == 0 then random_string(16) else null)
me.timeEntered = -1
me.app = 'talkspace'
me.space = window.location.pathname.split('/')[2]
me.space = window.location.pathname.split('/')[1]
me.video = true
me.audio = true
save(my_conn)
Expand Down Expand Up @@ -173,7 +173,9 @@
onmessage: (msg, jsep) ->
publishers = msg["publishers"] or []
for feed in publishers
new_remote_feed feed
conn = connections.all.find (el) -> el.id == feed.display
if conn.space == me.space
new_remote_feed feed

if msg["videoroom"] == "joined"
my_janus_id = msg["id"]
Expand Down Expand Up @@ -588,7 +590,7 @@
groups = {}
for conn in connections.all
if conn.app == 'talkspace' and
conn.space == window.location.pathname.split('/')[2] and
conn.space == window.location.pathname.split('/')[1] and
conn.group != null
if conn.group not of groups
groups[conn.group] = []
Expand Down

0 comments on commit 4983282

Please sign in to comment.