diff --git a/guacamole-common-js/src/main/resources/guacamole.js b/guacamole-common-js/src/main/resources/guacamole.js index 22564b9bc..a1a196062 100644 --- a/guacamole-common-js/src/main/resources/guacamole.js +++ b/guacamole-common-js/src/main/resources/guacamole.js @@ -270,6 +270,9 @@ Guacamole.Client = function(tunnel) { // No initial buffers var buffers = []; + // No initial parsers + var parsers = []; + tunnel.onerror = function(message) { if (guac_client.onerror) guac_client.onerror(message); @@ -464,6 +467,21 @@ Guacamole.Client = function(tunnel) { } + function getParser(index) { + + var parser = parsers[index]; + + // If parser not yet created, create it, and tie to the + // oninstruction handler of the tunnel. + if (parser == null) { + parser = parsers[index] = new Guacamole.Parser(); + parser.oninstruction = tunnel.oninstruction; + } + + return parser; + + } + /** * Handlers for all defined layer properties. * @private @@ -747,6 +765,11 @@ Guacamole.Client = function(tunnel) { if (guac_client.onname) guac_client.onname(parameters[0]); }, + "nest": function(parameters) { + var parser = getParser(parseInt(parameters[0])); + parser.receive(parameters[1]); + }, + "png": function(parameters) { var channelMask = parseInt(parameters[0]);