Permalink
Browse files

Warning if websocket failes to open

  • Loading branch information...
1 parent 9510e81 commit b6d8c39f12d9d3cf48f4391d4545794528baa9bf @mitotic committed Oct 2, 2012
Showing with 10 additions and 10 deletions.
  1. +2 −2 RELEASE_NOTES.rst
  2. +8 −8 graphterm/www/graphterm.js
View
@@ -49,8 +49,8 @@ GraphTerm Release Notes
- Updated documentation
- Syntax for ``gtermhost`` command has changed slightly
- *Action->Export* Environment to use GraphTerm across SSH logins
- - ``gmatlib.py`` to demo inline plotting using matplotlib
- - Wildcard session names for multiplexed stdin and stout (oshell-only)
+ - ``gmatplot.py`` to demo inline plotting using matplotlib
+ - Wildcard session names for multiplexed stdin and stdout (oshell-only)
- ``gotrace`` command to use *otrace* with any python program (including those reading from stdin)
- Clear terminal option
- ``giframe`` command to display files, URLs and HTML from stdin
View
@@ -533,11 +533,11 @@ function GTWebSocket(auth_user, auth_code) {
this.repeat_intervalID = null;
var protocol = (window.location.protocol.indexOf("https") == 0) ? "wss" : "ws";
- var ws_url = protocol+":/"+"/"+window.location.host+"/_websocket"+window.location.pathname; // Split the double slash to avoid confusing the JS minifier
+ this.ws_url = protocol+":/"+"/"+window.location.host+"/_websocket"+window.location.pathname; // Split the double slash to avoid confusing the JS minifier
if (this.auth_user || this.auth_code)
- ws_url += "?" + $.param({user: auth_user, code: auth_code});
- console.log("GTWebSocket url", ws_url);
- this.ws = new WebSocket(ws_url);
+ this.ws_url += "?" + $.param({user: auth_user, code: auth_code});
+ console.log("GTWebSocket url", this.ws_url);
+ this.ws = new WebSocket(this.ws_url);
this.ws.onopen = bind_method(this, this.onopen);
this.ws.onmessage = bind_method(this, this.onmessage);
this.ws.onclose = bind_method(this, this.onclose);
@@ -1230,10 +1230,11 @@ GTWebSocket.prototype.onmessage = function(evt) {
GTWebSocket.prototype.onclose = function(e) {
console.log("GTWebSocket.onclose: ");
- if (this.opened) {
- } else {
- this.failed = true;
+ if (!this.opened && !this.closed && !this.failed) {
+ this.failed = true;
+ alert("Failed to open websocket: "+this.ws_url);
}
+ this.closed = true;
}
GTWebSocket.prototype.abort = function() {
@@ -1247,7 +1248,6 @@ GTWebSocket.prototype.close = function() {
return;
this.closed = true;
- this.opened = false;
try {
this.ws.close();
} catch(err) {

0 comments on commit b6d8c39

Please sign in to comment.