mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 12:25:16 +00:00
Ready to implement WebSocket
This commit is contained in:
@ -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
24
assets/js/common/ws.js
Normal 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");
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user