Class: Parser

Guacamole.Parser()

new Parser()

Simple Guacamole protocol parser that invokes an oninstruction event when full instructions are available from data received via receive().
Source:

Methods

receive(packetnon-null, isBufferopt, non-null)

Appends the given instruction data packet to the internal buffer of this Guacamole.Parser, executing all completed instructions at the beginning of this buffer, if any.
Parameters:
Name Type Attributes Default Description
packet string The instruction data to receive.
isBuffer boolean <optional>
false Whether the provided data should be treated as an instruction buffer that grows continuously. If true, the data provided to receive() MUST always start with the data provided to the previous call. If false (the default), only the new data should be provided to receive(), and previously-received data will automatically be buffered by the parser as needed.
Source:

(static) codePointCount(strnon-null, startopt, endopt) → (non-null) {number}

Returns the number of Unicode codepoints (not code units) within the given string. If character offsets are provided, only codepoints between those offsets are counted. Unlike the length property of a string, this function counts proper surrogate pairs as a single codepoint. High and low surrogate characters that are not part of a proper surrogate pair are counted separately as individual codepoints.
Parameters:
Name Type Attributes Default Description
str string The string whose contents should be inspected.
start number <optional>
0 The index of the location in the given string where codepoint counting should start. If omitted, counting will begin at the start of the string.
end number <optional>
The index of the first location in the given string after where counting should stop (the character after the last character being counted). If omitted, all characters after the start location will be counted.
Source:
Returns:
The number of Unicode codepoints within the requested portion of the given string.
Type
number

(static) toInstruction(elementsnon-null) → (non-null) {string}

Converts each of the values within the given array to strings, formatting those strings as length-prefixed elements of a complete Guacamole instruction.
Parameters:
Name Type Description
elements Array.<*> The values that should be encoded as the elements of a Guacamole instruction. Order of these elements is preserved. This array MUST have at least one element.
Source:
Returns:
A complete Guacamole instruction consisting of each of the provided element values, in order.
Type
string

Events

oninstruction

Fired once for every complete Guacamole instruction received, in order.
Parameters:
Name Type Description
opcode string The Guacamole instruction opcode.
parameters Array.<string> The parameters provided for the instruction, if any.
Source: