mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-18 10:07:02 +00:00
Add connection status indicator for #44
This commit is contained in:
@@ -18,6 +18,9 @@ function startMonitor() {
|
||||
var url = ((l.protocol === "https:") ? "wss://" : "ws://") + l.host + uri
|
||||
var ws = new WebSocket(url);
|
||||
|
||||
ws.addEventListener('open', function (e) {
|
||||
$('#conn-status').text('Connected.');
|
||||
});
|
||||
ws.addEventListener('message', function (e) {
|
||||
var msg = JSON.parse(e.data);
|
||||
msg['href'] = '/mailbox?name=' + msg.mailbox + '&id=' + msg.id;
|
||||
@@ -26,6 +29,9 @@ function startMonitor() {
|
||||
msg,
|
||||
{ append: true });
|
||||
});
|
||||
ws.addEventListener('close', function (e) {
|
||||
$('#conn-status').text('Disconnected!');
|
||||
});
|
||||
}
|
||||
|
||||
function messageClick(node) {
|
||||
|
||||
Reference in New Issue
Block a user