openvidu-js-java minor 2.0.0 fixes
This commit is contained in:
parent
03c8036cc3
commit
c366ecb1b9
@ -63,7 +63,7 @@ public class LoginController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/logout", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/logout", method = RequestMethod.POST)
|
||||
public ResponseEntity<Object> logout(HttpSession session) {
|
||||
System.out.println("'" + session.getAttribute("loggedUser") + "' has logged out");
|
||||
session.invalidate();
|
||||
|
||||
@ -58,7 +58,7 @@ public class SessionController {
|
||||
|
||||
JSONObject sessionJSON = (JSONObject) new JSONParser().parse(sessionNameParam);
|
||||
|
||||
// The video-call to connect ("TUTORIAL")
|
||||
// The video-call to connect
|
||||
String sessionName = (String) sessionJSON.get("sessionName");
|
||||
|
||||
// Role associated to this user
|
||||
@ -139,7 +139,7 @@ public class SessionController {
|
||||
String sessionName = (String) sessionNameTokenJSON.get("sessionName");
|
||||
String token = (String) sessionNameTokenJSON.get("token");
|
||||
|
||||
// If the session exists ("TUTORIAL" in this case)
|
||||
// If the session exists
|
||||
if (this.mapSessions.get(sessionName) != null && this.mapSessionNamesTokens.get(sessionName) != null) {
|
||||
|
||||
// If the token exists
|
||||
|
||||
@ -44,6 +44,7 @@ function joinSession() {
|
||||
// --- 4) Connect to the session passing the retrieved token and some more data from
|
||||
// the client (in this case a JSON with the nickname chosen by the user) ---
|
||||
|
||||
var nickName = $("#nickName").val();
|
||||
session.connect(token, { clientData: nickName })
|
||||
.then(() => {
|
||||
|
||||
@ -130,8 +131,7 @@ function logIn() {
|
||||
var user = $("#user").val(); // Username
|
||||
var pass = $("#pass").val(); // Password
|
||||
|
||||
httpRequest(
|
||||
'POST',
|
||||
httpPostRequest(
|
||||
'api-login/login',
|
||||
{user: user, pass: pass},
|
||||
'Login WRONG',
|
||||
@ -147,10 +147,9 @@ function logIn() {
|
||||
}
|
||||
|
||||
function logOut() {
|
||||
httpRequest(
|
||||
'GET',
|
||||
httpPostRequest(
|
||||
'api-login/logout',
|
||||
null,
|
||||
{},
|
||||
'Logout WRONG',
|
||||
(response) => {
|
||||
$("#not-logged").show();
|
||||
@ -161,10 +160,8 @@ function logOut() {
|
||||
|
||||
function getToken(callback) {
|
||||
sessionName = $("#sessionName").val(); // Video-call chosen by the user
|
||||
nickName = $("#nickName").val(); // Nickname chosen by the user
|
||||
|
||||
httpRequest(
|
||||
'POST',
|
||||
httpPostRequest(
|
||||
'api-sessions/get-token',
|
||||
{sessionName: sessionName},
|
||||
'Request of TOKEN gone WRONG:',
|
||||
@ -177,8 +174,7 @@ function getToken(callback) {
|
||||
}
|
||||
|
||||
function removeUser() {
|
||||
httpRequest(
|
||||
'POST',
|
||||
httpPostRequest(
|
||||
'api-sessions/remove-user',
|
||||
{sessionName: sessionName, token: token},
|
||||
'User couldn\'t be removed from session',
|
||||
@ -188,9 +184,9 @@ function removeUser() {
|
||||
);
|
||||
}
|
||||
|
||||
function httpRequest(method, url, body, errorMsg, callback) {
|
||||
function httpPostRequest(url, body, errorMsg, callback) {
|
||||
var http = new XMLHttpRequest();
|
||||
http.open(method, url, true);
|
||||
http.open('POST', url, true);
|
||||
http.setRequestHeader('Content-type', 'application/json');
|
||||
http.addEventListener('readystatechange', processRequest, false);
|
||||
http.send(JSON.stringify(body));
|
||||
|
||||
@ -127,4 +127,4 @@
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user