Skip to content

Instantly share code, notes, and snippets.

@risacher
Created December 2, 2013 18:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save risacher/7753727 to your computer and use it in GitHub Desktop.
Save risacher/7753727 to your computer and use it in GitHub Desktop.
Example of how to use the user.js file in tty.js, to do something somewhat useful. This appends the io.socket transport type into the help text. I use this to know whether I've got websockets actually working on any given day.
if (window.tty) {
tty.on('open', function() {
var tty = window.tty;
window.tty.socket.on('connect', function() {
console.log('connect ',window.tty.socket.socket.transport.name);
document.getElementById('help').innerHTML += "<p>" + window.tty.socket.socket.transport.name;
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment