Desktop multi-user improvements.
This commit is contained in:
parent
0a18d312bf
commit
c74889ef74
|
@ -1400,8 +1400,10 @@ function createMeshCore(agent) {
|
|||
|
||||
// Send a metadata update to all desktop sessions
|
||||
var users = {};
|
||||
for (var i in this.httprequest.desktop.kvm.tunnels) { var userid = this.httprequest.desktop.kvm.tunnels[i].httprequest.userid; if (users[userid] == null) { users[userid] = 1; } else { users[userid]++; } }
|
||||
for (var i in this.httprequest.desktop.kvm.tunnels) { this.httprequest.desktop.kvm.tunnels[i].write(JSON.stringify({ ctrlChannel: '102938', type: 'metadata', users: users })); }
|
||||
if (this.httprequest.desktop.kvm.tunnels != null) {
|
||||
for (var i in this.httprequest.desktop.kvm.tunnels) { try { var userid = this.httprequest.desktop.kvm.tunnels[i].httprequest.userid; if (users[userid] == null) { users[userid] = 1; } else { users[userid]++; } } catch (ex) { } }
|
||||
for (var i in this.httprequest.desktop.kvm.tunnels) { try { this.httprequest.desktop.kvm.tunnels[i].write(JSON.stringify({ ctrlChannel: '102938', type: 'metadata', users: users })); } catch (ex) { } }
|
||||
}
|
||||
|
||||
this.end = function () {
|
||||
--this.desktop.kvm.connectionCount;
|
||||
|
@ -1412,8 +1414,10 @@ function createMeshCore(agent) {
|
|||
|
||||
// Send a metadata update to all desktop sessions
|
||||
var users = {};
|
||||
for (var i in this.httprequest.desktop.kvm.tunnels) { var userid = this.httprequest.desktop.kvm.tunnels[i].httprequest.userid; if (users[userid] == null) { users[userid] = 1; } else { users[userid]++; } }
|
||||
for (var i in this.httprequest.desktop.kvm.tunnels) { this.httprequest.desktop.kvm.tunnels[i].write(JSON.stringify({ ctrlChannel: '102938', type: 'metadata', users: users })); }
|
||||
if (this.httprequest.desktop.kvm.tunnels != null) {
|
||||
for (var i in this.httprequest.desktop.kvm.tunnels) { try { var userid = this.httprequest.desktop.kvm.tunnels[i].httprequest.userid; if (users[userid] == null) { users[userid] = 1; } else { users[userid]++; } } catch (ex) { } }
|
||||
for (var i in this.httprequest.desktop.kvm.tunnels) { try { this.httprequest.desktop.kvm.tunnels[i].write(JSON.stringify({ ctrlChannel: '102938', type: 'metadata', users: users })); } catch (ex) { } }
|
||||
}
|
||||
|
||||
// Unpipe the web socket
|
||||
try
|
||||
|
|
|
@ -209,7 +209,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||
}
|
||||
|
||||
// If this is the last viewer, disconnect the agent
|
||||
if ((obj.viewers.length == 0) && (obj.agent != null)) { obj.agent.close(); dispose(); return true; }
|
||||
if ((obj.viewers != null) && (obj.viewers.length == 0) && (obj.agent != null)) { obj.agent.close(); dispose(); return true; }
|
||||
|
||||
// Send an updated list of all peers to all viewers
|
||||
obj.sendSessionMetadata();
|
||||
|
|
|
@ -6042,7 +6042,7 @@
|
|||
function updateMetadata(conn, elementid) {
|
||||
var str = '', viewerCount = 0;
|
||||
if (conn && (conn.State == 3)) {
|
||||
if (conn.metadata && conn.metadata.users) { for (var i in conn.metadata.users) { viewerCount++; } }
|
||||
if (conn.metadata && conn.metadata.users) { for (var i in conn.metadata.users) { viewerCount += conn.metadata.users[i]; } }
|
||||
if (viewerCount > 1) { str = '<span onclick=showSessionMetadata(1) style=cursor:pointer>' + format(", {0} watching", viewerCount) + '</span>'; }
|
||||
}
|
||||
QH('deskmetadata', str);
|
||||
|
|
Loading…
Reference in New Issue