Skip to content

Node.js based forum software built for the modern web

disconnect event

Baris Usakliecc621e0c1b4
diff --git a/public/src/app.js b/public/src/app.js
index d5404d66ab..4dd812a330 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -31,10 +31,16 @@ var socket,
contentEl.value = data.post;
});
+
+ socket.on('disconnect', function(data){
+ $('#disconnect-modal').show();
+ $('#reload-button').on('click',function(){
+ $('#disconnect-modal').hide();
+ window.location.reload();
+ });
+ });
},
async: false
-
-
});
// use unique alert_id to have multiple alerts visible at a time, use the same alert_id to fade out the current instance
diff --git a/public/templates/header.tpl b/public/templates/header.tpl
index c7b4449ad4..af5707b826 100644
--- a/public/templates/header.tpl
+++ b/public/templates/header.tpl
@@ -78,6 +78,19 @@
</div>
</div>
</div>
+
+ <div id="disconnect-modal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-header">
+ <h3 id="myModalLabel">Socket Disconnect</h3>
+ </div>
+ <div class="modal-body">
+ <span>Looks like you disconnected, try reloading the page.</span>
+ </div>
+ <div class="modal-footer">
+ <a id="reload-button" href="/" class="btn btn-primary">Reload</a>
+ </div>
+ </div>
+
<div id="notification_window"></div>
<div class="container" id="content">
\ No newline at end of file