Ready to implement WebSocket

This commit is contained in:
2020-03-29 18:04:50 +02:00
parent 99aafe3799
commit a027e96071
4 changed files with 37 additions and 1 deletions

View File

@ -79,6 +79,10 @@ ComunicWeb.common.system = {
//Open specified page
ComunicWeb.common.page.openPage(openPage);
// Initialize Websocket if user is connect
if(signed_in())
UserWebSocket.Connect();
//End of init
ComunicWeb.debug.logMessage("Application is ready !");
}
@ -91,6 +95,7 @@ ComunicWeb.common.system = {
/**
* Automaticaly refresh login state
*/
// TODO : remove when websockets are implemented
var autoRefresh = setInterval((function(){
ComunicWeb.user.userLogin.refreshLoginState();
}), 25000);

24
assets/js/common/ws.js Normal file
View File

@ -0,0 +1,24 @@
/**
* Main client websocket
*
* @author Pierre HUBERT
*/
class UserWebSocket {
/**
* Connect to server
*/
static async Connect() {
await this.Disconnect();
console.log("Connect to websocket");
}
/**
* Disconnect from server
*/
static async Disconnect() {
console.log("Disconnect from websockt");
}
}