Class: Client

Guacamole.Client(tunnelnon-null)

new Client(tunnelnon-null)

Guacamole protocol client. Given a Guacamole.Tunnel, automatically handles incoming and outgoing Guacamole instructions via the provided tunnel, updating its display using one or more canvas elements.
Parameters:
Name Type Description
tunnel Guacamole.Tunnel The tunnel to use to send and receive Guacamole instructions.
Source:

Members

(static, non-null) Message :Object.<string, number>

A list of possible messages that can be sent by the server for processing by the client.
Type:
  • Object.<string, number>
Source:

Methods

connect(data)

Connects the underlying tunnel of this Guacamole.Client, passing the given arbitrary data to the tunnel during the connection process.
Parameters:
Name Type Description
data string Arbitrary connection data to be sent to the underlying tunnel during the connection process.
Source:
Throws:
If an error occurs during connection.
Type
Guacamole.Status

createArgumentValueStream(mimetypenon-null, namenon-null) → (non-null) {Guacamole.OutputStream}

Opens a new argument value stream for writing, having the given parameter name and mimetype, requesting that the connection parameter with the given name be updated to the value described by the contents of the following stream. The instruction necessary to create this stream will automatically be sent.
Parameters:
Name Type Description
mimetype string The mimetype of the data being sent.
name string The name of the connection parameter to attempt to update.
Source:
Returns:
The created argument value stream.
Type
Guacamole.OutputStream

createAudioStream(mimetypenon-null) → (non-null) {Guacamole.OutputStream}

Opens a new audio stream for writing, where audio data having the give mimetype will be sent along the returned stream. The instruction necessary to create this stream will automatically be sent.
Parameters:
Name Type Description
mimetype string The mimetype of the audio data that will be sent along the returned stream.
Source:
Returns:
The created audio stream.
Type
Guacamole.OutputStream

createClipboardStream(mimetypenon-null, namenon-null) → (non-null) {Guacamole.OutputStream}

Opens a new clipboard object for writing, having the given mimetype. The instruction necessary to create this stream will automatically be sent.
Parameters:
Name Type Description
mimetype string The mimetype of the data being sent.
name string The name of the pipe.
Source:
Returns:
The created file stream.
Type
Guacamole.OutputStream

createFileStream(mimetypenon-null, filenamenon-null) → (non-null) {Guacamole.OutputStream}

Opens a new file for writing, having the given index, mimetype and filename. The instruction necessary to create this stream will automatically be sent.
Parameters:
Name Type Description
mimetype string The mimetype of the file being sent.
filename string The filename of the file being sent.
Source:
Returns:
The created file stream.
Type
Guacamole.OutputStream

createObjectOutputStream(indexnon-null, mimetypenon-null, namenon-null) → (non-null) {Guacamole.OutputStream}

Creates a new output stream associated with the given object and having the given mimetype and name. The legality of a mimetype and name is dictated by the object itself. The instruction necessary to create this stream will automatically be sent.
Parameters:
Name Type Description
index number The index of the object for which the output stream is being created.
mimetype string The mimetype of the data which will be sent to the output stream.
name string The defined name of an output stream within the given object.
Source:
Returns:
An output stream which will write blobs to the named output stream of the given object.
Type
Guacamole.OutputStream

createOutputStream() → (non-null) {Guacamole.OutputStream}

Allocates an available stream index and creates a new Guacamole.OutputStream using that index, associating the resulting stream with this Guacamole.Client. Note that this stream will not yet exist as far as the other end of the Guacamole connection is concerned. Streams exist within the Guacamole protocol only when referenced by an instruction which creates the stream, such as a "clipboard", "file", or "pipe" instruction.
Source:
Returns:
A new Guacamole.OutputStream with a newly-allocated index and associated with this Guacamole.Client.
Type
Guacamole.OutputStream

createPipeStream(mimetypenon-null, namenon-null) → (non-null) {Guacamole.OutputStream}

Opens a new pipe for writing, having the given name and mimetype. The instruction necessary to create this stream will automatically be sent.
Parameters:
Name Type Description
mimetype string The mimetype of the data being sent.
name string The name of the pipe.
Source:
Returns:
The created file stream.
Type
Guacamole.OutputStream

disconnect()

Sends a disconnect instruction to the server and closes the tunnel.
Source:

endStream(indexnon-null)

Marks a currently-open stream as complete. The other end of the Guacamole connection will be notified via an "end" instruction that the stream is closed, and the index will be made available for reuse in future streams.
Parameters:
Name Type Description
index number The index of the stream to end.
Source:

exportState(callbacknon-null)

Produces an opaque representation of Guacamole.Client state which can be later imported through a call to importState(). This object is effectively an independent, compressed snapshot of protocol and display state. Invoking this function implicitly flushes the display.
Parameters:
Name Type Description
callback function Callback which should be invoked once the state object is ready. The state object will be passed to the callback as the sole parameter. This callback may be invoked immediately, or later as the display finishes rendering and becomes ready.
Source:

getDisplay() → (non-null) {Guacamole.Display}

Returns the underlying display of this Guacamole.Client. The display contains an Element which can be added to the DOM, causing the display to become visible.
Source:
Returns:
The underlying display of this Guacamole.Client.
Type
Guacamole.Display

importState(statenon-null, callbackopt)

Restores Guacamole.Client protocol and display state based on an opaque object from a prior call to exportState(). The Guacamole.Client instance used to export that state need not be the same as this instance.
Parameters:
Name Type Attributes Description
state object An opaque representation of Guacamole.Client state from a prior call to exportState().
callback function <optional>
The function to invoke when state has finished being imported. This may happen immediately, or later as images within the provided state object are loaded.
Source:

requestObjectInputStream(indexnon-null, namenon-null)

Requests read access to the input stream having the given name. If successful, a new input stream will be created.
Parameters:
Name Type Description
index number The index of the object from which the input stream is being requested.
name string The name of the input stream to request.
Source:

sendAck(indexnon-null, messagenon-null, codenon-null)

Acknowledge receipt of a blob on the stream with the given index.
Parameters:
Name Type Description
index number The index of the stream associated with the received blob.
message string A human-readable message describing the error or status.
code number The error code, if any, or 0 for success.
Source:

sendBlob(indexnon-null, datanon-null)

Given the index of a file, writes a blob of data to that file.
Parameters:
Name Type Description
index number The index of the file to write to.
data string Base64-encoded data to write to the file.
Source:

sendKeyEvent(pressednon-null, keysymnon-null)

Sends a key event having the given properties as if the user pressed or released a key.
Parameters:
Name Type Description
pressed boolean Whether the key is pressed (true) or released (false).
keysym number The keysym of the key being pressed or released.
Source:

sendMouseState(mouseStatenon-null, applyDisplayScaleopt)

Sends a mouse event having the properties provided by the given mouse state.
Parameters:
Name Type Attributes Default Description
mouseState Guacamole.Mouse.State The state of the mouse to send in the mouse event.
applyDisplayScale boolean <optional>
false Whether the provided mouse state uses local display units, rather than remote display units, and should be scaled to match the Guacamole.Display.
Source:

sendSize(widthnon-null, heightnon-null)

Sends the current size of the screen.
Parameters:
Name Type Description
width number The width of the screen.
height number The height of the screen.
Source:

sendTouchState(touchStatenon-null, applyDisplayScaleopt)

Sends a touch event having the properties provided by the given touch state.
Parameters:
Name Type Attributes Default Description
touchState Guacamole.Touch.State The state of the touch contact to send in the touch event.
applyDisplayScale boolean <optional>
false Whether the provided touch state uses local display units, rather than remote display units, and should be scaled to match the Guacamole.Display.
Source:

(inner) getLayerIndex(layernon-null) → {number}

Returns the index passed to getLayer() when the given layer was created. Positive indices refer to visible layers, an index of zero refers to the default layer, and negative indices refer to buffers.
Parameters:
Name Type Description
layer Guacamole.Display.VisibleLayer | Guacamole.Layer The layer whose index should be determined.
Source:
Returns:
The index of the given layer, or null if no such layer is associated with this client.
Type
number

Events

onargv

Fired when the current value of a connection parameter is being exposed by the server.
Parameters:
Name Type Description
stream Guacamole.InputStream The stream that will receive connection parameter data from the server.
mimetype string The mimetype of the data which will be received.
name string The name of the connection parameter whose value is being exposed.
Source:

onaudio

Fired when a audio stream is created. The stream provided to this event handler will contain its own event handlers for received data.
Parameters:
Name Type Description
stream Guacamole.InputStream The stream that will receive audio data from the server.
mimetype string The mimetype of the audio data which will be received.
Source:
Returns:
An object which implements the Guacamole.AudioPlayer interface and has been initialized to play the data in the provided stream, or null if the built-in audio players of the Guacamole client should be used.
Type
Guacamole.AudioPlayer

onclipboard

Fired when the clipboard of the remote client is changing.
Parameters:
Name Type Description
stream Guacamole.InputStream The stream that will receive clipboard data from the server.
mimetype string The mimetype of the data which will be received.
Source:

onerror

Fired when an error is reported by the remote client, and the connection is being closed.
Parameters:
Name Type Description
status Guacamole.Status A status object which describes the error.
Source:

onfile

Fired when a file stream is created. The stream provided to this event handler will contain its own event handlers for received data.
Parameters:
Name Type Description
stream Guacamole.InputStream The stream that will receive data from the server.
mimetype string The mimetype of the file received.
filename string The name of the file received.
Source:

onfilesystem

Fired when a filesystem object is created. The object provided to this event handler will contain its own event handlers and functions for requesting and handling data.
Parameters:
Name Type Description
object Guacamole.Object The created filesystem object.
name string The name of the filesystem.
Source:

onjoin

Fired when a user joins a shared connection.
Parameters:
Name Type Description
userID string A unique value representing this specific user's connection to the shared connection. This value is generated by the server and is guaranteed to be unique relative to other users of the connection.
name string A human-readable name representing the user that joined, such as their username. This value is provided by the web application during the connection handshake and is not necessarily unique relative to other users of the connection.
Source:

onleave

Fired when a user leaves a shared connection.
Parameters:
Name Type Description
userID string A unique value representing this specific user's connection to the shared connection. This value is generated by the server and is guaranteed to be unique relative to other users of the connection.
name string A human-readable name representing the user that left, such as their username. This value is provided by the web application during the connection handshake and is not necessarily unique relative to other users of the connection.
Source:

onmsg

Fired when an arbitrary message is received from the tunnel that should be processed by the client. By default, additional message-specific events such as "onjoin" and "onleave" will fire for the received message after this event has been processed. An event handler for "onmsg" need not be supplied if "onjoin" and/or "onleave" will be used.
Parameters:
Name Type Description
msgcode number A status code sent by the remote server that indicates the nature of the message that is being sent to the client.
args Array.<string> An array of arguments to be processed with the message sent to the client.
Source:
Returns:
true if message-specific events such as "onjoin" and "onleave" should be fired for this message, false otherwise. If no value is returned, message-specific events will be allowed to fire.
Type
boolean

onmultitouch

Fired when the remote client is explicitly declaring the level of multi-touch support provided by a particular display layer.
Parameters:
Name Type Description
layer Guacamole.Display.VisibleLayer The layer whose multi-touch support level is being declared.
touches number The maximum number of simultaneous touches supported by the given layer, where 0 indicates that touch events are not supported at all.
Source:

onname

Fired when the remote client sends a name update.
Parameters:
Name Type Description
name string The new name of this client.
Source:

onpipe

Fired when a pipe stream is created. The stream provided to this event handler will contain its own event handlers for received data;
Parameters:
Name Type Description
stream Guacamole.InputStream The stream that will receive data from the server.
mimetype string The mimetype of the data which will be received.
name string The name of the pipe.
Source:

onrequired

Fired when a "required" instruction is received. A required instruction indicates that additional parameters are required for the connection to continue, such as user credentials.
Parameters:
Name Type Description
parameters Array.<string> The names of the connection parameters that are required to be provided for the connection to continue.
Source:

onstatechange

Fired whenever the state of this Guacamole.Client changes.
Parameters:
Name Type Description
state number The new state of the client.
Source:

onsync

Fired whenever a sync instruction is received from the server, indicating that the server is finished processing any input from the client and has sent any results.
Parameters:
Name Type Description
timestamp number The timestamp associated with the sync instruction.
Source:

onvideo

Fired when a video stream is created. The stream provided to this event handler will contain its own event handlers for received data.
Parameters:
Name Type Description
stream Guacamole.InputStream The stream that will receive video data from the server.
layer Guacamole.Display.VisibleLayer The destination layer on which the received video data should be played. It is the responsibility of the Guacamole.VideoPlayer implementation to play the received data within this layer.
mimetype string The mimetype of the video data which will be received.
Source:
Returns:
An object which implements the Guacamole.VideoPlayer interface and has been initialized to play the data in the provided stream, or null if the built-in video players of the Guacamole client should be used.
Type
Guacamole.VideoPlayer