diff --git a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig index 3208b15d..d4135296 100644 --- a/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig +++ b/src/ninegate-1.0/src/Cadoles/WebsocketBundle/Resources/views/Chat/client.html.twig @@ -120,7 +120,7 @@ {% endblock %} {% block localjavascript %} - var webSocket; +var webSocket; $(document).ready(function(){ if (CKEDITOR.instances["chat_message"]) CKEDITOR.instances["chat_message"].destroy(); @@ -147,14 +147,25 @@ },500); $(".switch").bootstrapSwitch(); - var dateoptions = {weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" }; $("#mymodal-sendmail").removeAttr("tabindex"); + websocket(); + + }); + + function websocket() + { {% if websocket_activate and app.user %} var _WS_URI = "wss://{{ gos_web_socket_server_host }}:{{ gos_web_socket_server_port }}"; - webSocket = WS.connect(_WS_URI); - var timer; + console.log("INI WS"); + webSocket = WS.connect(_WS_URI); + console.log("END INI WS"); + + var dateoptions = {weekday: "long", year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" }; + var timer; + var session; + webSocket.on("socket/connect", function (session) { // Reinit du tps de tentative de reco $('#modalinfo').modal('hide'); @@ -260,39 +271,50 @@ webSocket.on("socket/disconnect", function(error){ laberror="Disconnected for " + error.reason + " with code " + error.code; + console.log("=== DISCONNECT ==="); console.log(laberror); - $('#modalinfo').modal('show'); + if(error.code==2) { + $('#modalinfo').modal('show'); $('#modalinfotext').html("
"+laberror+"
"+laberror+"
"+laberror+"