openvidu-java-client: Connection.location and Connection.platform support

pull/121/head
pabloFuente 2018-09-05 17:04:05 +02:00
parent e0ba895faf
commit 0828bc6f12
2 changed files with 24 additions and 3 deletions

View File

@ -29,17 +29,21 @@ public class Connection {
private String connectionId; private String connectionId;
private OpenViduRole role; private OpenViduRole role;
private String token; private String token;
private String location;
private String platform;
private String serverData; private String serverData;
private String clientData; private String clientData;
protected Map<String, Publisher> publishers; protected Map<String, Publisher> publishers;
protected List<String> subscribers; protected List<String> subscribers;
protected Connection(String connectionId, OpenViduRole role, String token, String serverData, String clientData, protected Connection(String connectionId, OpenViduRole role, String token, String location, String platform, String serverData, String clientData,
Map<String, Publisher> publishers, List<String> subscribers) { Map<String, Publisher> publishers, List<String> subscribers) {
this.connectionId = connectionId; this.connectionId = connectionId;
this.role = role; this.role = role;
this.token = token; this.token = token;
this.location = location;
this.platform = platform;
this.serverData = serverData; this.serverData = serverData;
this.clientData = clientData; this.clientData = clientData;
this.publishers = publishers; this.publishers = publishers;
@ -69,6 +73,23 @@ public class Connection {
return token; return token;
} }
/**
* Returns the geo location of the connection, with the following format:
* <code>"CITY, COUNTRY"</code> (<code>"unknown"</code> if it wasn't possible to
* locate it)
*/
public String getLocation() {
return location;
}
/**
* Returns a complete description of the platform used by the participant to
* connect to the session
*/
public String getPlatform() {
return platform;
}
/** /**
* Returns the data associated to the connection on the server-side. This value * Returns the data associated to the connection on the server-side. This value
* is set with {@link io.openvidu.java.client.TokenOptions.Builder#data(String)} * is set with {@link io.openvidu.java.client.TokenOptions.Builder#data(String)}

View File

@ -529,8 +529,8 @@ public class Session {
this.activeConnections.put((String) con.get("connectionId"), this.activeConnections.put((String) con.get("connectionId"),
new Connection((String) con.get("connectionId"), OpenViduRole.valueOf((String) con.get("role")), new Connection((String) con.get("connectionId"), OpenViduRole.valueOf((String) con.get("role")),
(String) con.get("token"), (String) con.get("serverData"), (String) con.get("clientData"), (String) con.get("token"), (String) con.get("location"), (String) con.get("platform"),
publishers, subscribers)); (String) con.get("serverData"), (String) con.get("clientData"), publishers, subscribers));
}); });
return this; return this;
} }