From: Michael Jumper Date: Fri, 9 Mar 2012 20:27:16 +0000 (-0800) Subject: Implemented WebSocketTunnel. X-Git-Url: http://git.alex.org.uk Implemented WebSocketTunnel. --- diff --git a/src/main/resources/tunnel.js b/src/main/resources/tunnel.js index 99a87d3..50d5969 100644 --- a/src/main/resources/tunnel.js +++ b/src/main/resources/tunnel.js @@ -503,12 +503,38 @@ Guacamole.WebSocketTunnel = function(tunnelURL) { } - this.sendMessage = function(message) { + this.sendMessage = function(elements) { // Do not attempt to send messages if not connected if (currentState != STATE_CONNECTED) return; + // Do not attempt to send empty messages + if (arguments.length == 0) + return; + + /** + * Converts the given value to a length/string pair for use as an + * element in a Guacamole instruction. + * + * @param value The value to convert. + * @return {String} The converted value. + */ + function getElement(value) { + var string = new String(value); + return string.length + "." + string; + } + + // Initialized message with first element + var message = getElement(arguments[0]); + + // Append remaining elements + for (var i=1; i