remove /*TMP*/ to test websocket.jar

This commit is contained in:
xdrm-brackets 2017-12-04 14:53:16 +01:00
parent c2f3f0ce15
commit dfe9843845
1 changed files with 22 additions and 6 deletions

View File

@ -40,14 +40,22 @@ window.wsc_connect = window.wsc.channel('connect').listen(function(msg, err){
// {1} Manage error // // {1} Manage error //
if( msg == null && err != null ){ if( msg == null && err != null ){
console.warn(err); window.gstore.data.info.message = 'Erreur de connexion WebSocket@connect ('+err+')';
/*TEMP*///return; window.gstore.data.info.type = 'warning';
/*TEMP*/msg = {error: 0, connected: ['guest123', 'guest456', 'guest789']}; window.gstore.data.info.active = true;
setTimeout(function(){ window.gstore.data.info.active=false; }, 5000);
/*TEMP*/return;
/*TEMP*///msg = {error: 0, connected: ['guest123', 'guest456', 'guest789']};
} }
// {2} Manage wsclient error // // {2} Manage wsclient error //
if( msg.connected == null || msg.error == null || msg.error !== 0 ){ if( msg.connected == null || msg.error == null || msg.error !== 0 ){
console.warn('websocket error: '+msg.error); console.warn('websocket error: '+msg.error);
if( msg.error == null ) window.gstore.data.info.message = 'Erreur de connexion WebSocket@connect (Unknown Error)';
else window.gstore.data.info.message = 'Erreur de connexion WebSocket@connect ('+msg.error+')';
window.gstore.data.info.type = 'warning';
window.gstore.data.info.active = true;
setTimeout(function(){ window.gstore.data.info.active=false; }, 5000);
return; return;
} }
@ -62,14 +70,22 @@ window.wsc_chat = window.wsc.channel('chat').listen(function(msg, err){
// {1} Manage error // // {1} Manage error //
if( msg == null && err != null ){ if( msg == null && err != null ){
console.warn(err); window.gstore.data.info.message = 'Erreur de connexion WebSocket@connect ('+err+')';
/*TEMP*///return; window.gstore.data.info.type = 'warning';
/*TEMP*/msg = {error: 0, msg: [['guest123', 'message 1'], ['guest456', 'message 2'], ['guest789', 'message 3']]}; window.gstore.data.info.active = true;
setTimeout(function(){ window.gstore.data.info.active=false; }, 5000);
/*TEMP*/return;
/*TEMP*///msg = {error: 0, msg: [['guest123', 'message 1'], ['guest456', 'message 2'], ['guest789', 'message 3']]};
} }
// {2} Manage wsclient error // // {2} Manage wsclient error //
if( msg.msg == null || msg.error == null || msg.error !== 0 ){ if( msg.msg == null || msg.error == null || msg.error !== 0 ){
console.warn('websocket error: '+msg.error); console.warn('websocket error: '+msg.error);
if( msg.error == null ) window.gstore.data.info.message = 'Erreur de connexion WebSocket@connect (Unknown Error)';
else window.gstore.data.info.message = 'Erreur de connexion WebSocket@connect ('+msg.error+')';
window.gstore.data.info.type = 'warning';
window.gstore.data.info.active = true;
setTimeout(function(){ window.gstore.data.info.active=false; }, 5000);
return; return;
} }