forked from cory/tildefriends
Websocket error messages and misc.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3804 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
d062db2ba8
commit
40216377f9
@ -1 +1 @@
|
|||||||
{"type":"tildefriends-app","files":{"app.js":"&OOcUHSIAA6CR2dYSv2BwOMBZ1hjFg+PJZPABhZMe1Gc=.sha256","index.html":"&vAy6mHSTMNDHo2P9CuRbsi0FMRtbOXXOP/2JbfGiZMU=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&3dPiSNYjoJE3zn1oTT1SBhbvkW9MHr7ZUDxUJiBI1Ss=.sha256","tf.js":"&/yKh5E/PLaK/M3tivdldiEDnpeYQYyuLHWjjdM/QpxE=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&+qPP3g4CAUlkt8K4iBCZ+F5Fy6N7fu6MggvSVss2juE=.sha256"}}
|
{"type":"tildefriends-app","files":{"app.js":"&OOcUHSIAA6CR2dYSv2BwOMBZ1hjFg+PJZPABhZMe1Gc=.sha256","index.html":"&ko7qv1Ihzmw8ibXr0RinyzNBc2xNzcGDQDPO9X3JAAQ=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&3dPiSNYjoJE3zn1oTT1SBhbvkW9MHr7ZUDxUJiBI1Ss=.sha256","tf.js":"&/yKh5E/PLaK/M3tivdldiEDnpeYQYyuLHWjjdM/QpxE=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&+qPP3g4CAUlkt8K4iBCZ+F5Fy6N7fu6MggvSVss2juE=.sha256"}}
|
@ -65,7 +65,7 @@
|
|||||||
<div class="md-layout">
|
<div class="md-layout">
|
||||||
<md-field class="md-layout-item">
|
<md-field class="md-layout-item">
|
||||||
<label>Post a message</label>
|
<label>Post a message</label>
|
||||||
<md-textarea id="post_text" v-model="post_text" v-on:paste="paste"></md-textarea>
|
<md-textarea id="post_text" v-model="post_text" v-on:paste="paste" md-autogrow></md-textarea>
|
||||||
</md-field>
|
</md-field>
|
||||||
<md-card class="md-layout-item" v-if="post_text && post_text.length">
|
<md-card class="md-layout-item" v-if="post_text && post_text.length">
|
||||||
<md-card-content v-html="markdown(post_text)"></md-card-content>
|
<md-card-content v-html="markdown(post_text)"></md-card-content>
|
||||||
|
@ -435,7 +435,7 @@ function receive(message) {
|
|||||||
var iframe = document.getElementById("document");
|
var iframe = document.getElementById("document");
|
||||||
iframe.contentWindow.postMessage(message.message, "*");
|
iframe.contentWindow.postMessage(message.message, "*");
|
||||||
} else if (message && message.action == "ping") {
|
} else if (message && message.action == "ping") {
|
||||||
gSocket.send(JSON.stringify({action: "pong"}));
|
send({action: "pong"});
|
||||||
} else if (message && message.action == "error") {
|
} else if (message && message.action == "error") {
|
||||||
if (message.error) {
|
if (message.error) {
|
||||||
if (typeof(message.error) == 'string') {
|
if (typeof(message.error) == 'string') {
|
||||||
@ -701,7 +701,24 @@ function connectSocket(path) {
|
|||||||
receive(JSON.parse(event.data));
|
receive(JSON.parse(event.data));
|
||||||
}
|
}
|
||||||
gSocket.onclose = function(event) {
|
gSocket.onclose = function(event) {
|
||||||
setStatusMessage("Connection closed with code " + event.code, kErrorColor);
|
const k_codes = {
|
||||||
|
1000: 'Normal closure',
|
||||||
|
1001: 'Going away',
|
||||||
|
1002: 'Protocol error',
|
||||||
|
1003: 'Unsupported data',
|
||||||
|
1005: 'No status received',
|
||||||
|
1006: 'Abnormal closure',
|
||||||
|
1007: 'Invalid frame payload data',
|
||||||
|
1008: 'Policy violation',
|
||||||
|
1009: 'Message too big',
|
||||||
|
1010: 'Missing extension',
|
||||||
|
1011: 'Internal error',
|
||||||
|
1012: 'Service restart',
|
||||||
|
1013: 'Try again later',
|
||||||
|
1014: 'Bad gateway',
|
||||||
|
1015: 'TLS handshake',
|
||||||
|
};
|
||||||
|
setStatusMessage("Connection closed: " + (k_codes[event.code] || event.code), kErrorColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user