Site
- websocket try to reconnect when it disconnected - add function on search bar in lobby page for search user Django - add request search user to find someone in database and return a list
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/31 22:17:24 by edbernar #+# #+# */
|
||||
/* Updated: 2024/09/17 14:31:46 by edbernar ### ########.fr */
|
||||
/* Updated: 2024/09/18 08:31:09 by edbernar ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -19,6 +19,7 @@ import { typePrivateListUser } from "/static/javascript/typeResponse/typePrivate
|
||||
import { typeCreateAccount } from "/static/javascript/typeResponse/typeCreateAccount.js";
|
||||
import { typeAllListUser }from "/static/javascript/typeResponse/typeAllListUser.js";
|
||||
import { createNotification as CN } from "/static/javascript/notification/main.js";
|
||||
import { typeSearchUser } from "/static/javascript/typeResponse/typeSearchUser.js";
|
||||
import { typeLogin } from "/static/javascript/typeResponse/typeLogin.js";
|
||||
import { typeGame } from "/static/javascript/typeResponse/typeGame.js"
|
||||
|
||||
@ -30,8 +31,8 @@ function launchSocket()
|
||||
{
|
||||
socket = new WebSocket('/ws');
|
||||
|
||||
const typeResponse = ["logged_in", "login", "private_list_user", "private_list_message", "new_private_message", "all_list_user", "create_account", "game"];
|
||||
const functionResponse = [typeLogin, typeLogin, typePrivateListUser, typePrivateListMessage, typeNewPrivateMessage, typeAllListUser, typeCreateAccount, typeGame];
|
||||
const typeResponse = ["logged_in", "login", "private_list_user", "private_list_message", "new_private_message", "all_list_user", "create_account", "game", "search_user"];
|
||||
const functionResponse = [typeLogin, typeLogin, typePrivateListUser, typePrivateListMessage, typeNewPrivateMessage, typeAllListUser, typeCreateAccount, typeGame, typeSearchUser];
|
||||
|
||||
const errorCode = [9007, 9010, 9011];
|
||||
const errorFunction = [typeErrorInvalidPassword, typeErrorInvalidToken42, typeErrorUnknown42Account];
|
||||
@ -82,6 +83,9 @@ function launchSocket()
|
||||
socket.onclose = () => {
|
||||
status = 0;
|
||||
console.log('Disconnected');
|
||||
setTimeout(() => {
|
||||
launchSocket();
|
||||
}, 500);
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user