new Client(tunnel)
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. |
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 |
Arbitrary connection data to be sent to the underlying tunnel during the connection process. |
Throws:
-
If an error occurs during connection.
- Type
- Guacamole.Status
createClipboardStream(mimetype, name) → {Guacamole.OutputStream}
Opens a new clipboard object for writing, having the given mimetype.
Parameters:
Name | Type | Description |
---|---|---|
mimetype |
String | The mimetype of the data being sent. |
name |
String | The name of the pipe. |
Returns:
The created file stream.
createFileStream(mimetype, filename) → {Guacamole.OutputStream}
Opens a new file for writing, having the given index, mimetype and
filename.
Parameters:
Name | Type | Description |
---|---|---|
mimetype |
String | The mimetype of the file being sent. |
filename |
String | The filename of the file being sent. |
Returns:
The created file stream.
createObjectOutputStream(index, mimetype, name) → {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.
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. |
Returns:
An output stream which will write blobs to the named output stream
of the given object.
createPipeStream(mimetype, name) → {Guacamole.OutputStream}
Opens a new pipe for writing, having the given name and mimetype.
Parameters:
Name | Type | Description |
---|---|---|
mimetype |
String | The mimetype of the data being sent. |
name |
String | The name of the pipe. |
Returns:
The created file stream.
disconnect()
Sends a disconnect instruction to the server and closes the tunnel.
endStream(index)
Marks a currently-open stream as complete.
Parameters:
Name | Type | Description |
---|---|---|
index |
Number | The index of the stream to end. |
getDisplay() → {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.
Returns:
The underlying display of this
Guacamole.Client.
- Type
- Guacamole.Display
requestObjectInputStream(index, name)
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. |
sendAck(index, message, code)
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. |
sendBlob(index, data)
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. |
sendKeyEvent(pressed, keysym)
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. |
sendMouseState(mouseState)
Sends a mouse event having the properties provided by the given mouse
state.
Parameters:
Name | Type | Description |
---|---|---|
mouseState |
Guacamole.Mouse.State | The state of the mouse to send in the mouse event. |
sendSize(width, height)
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. |
setClipboard(data)
Sets the clipboard of the remote client to the given text data.
Parameters:
Name | Type | Description |
---|---|---|
data |
String | The data to send as the clipboard contents. |
Events
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. |
Returns:
An object which implements the Guacamole.AudioPlayer interface and
has been initialied to play the data in the provided stream, or null
if the built-in audio players of the Guacamole client should be
used.
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. |
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. |
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. |
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. |
onname
Fired when the remote client sends a name update.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | The new name of this client. |
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. |
onstatechange
Fired whenever the state of this Guacamole.Client changes.
Parameters:
Name | Type | Description |
---|---|---|
state |
Number | The new state of the client. |
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. |
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. |
Returns:
An object which implements the Guacamole.VideoPlayer interface and
has been initialied to play the data in the provided stream, or null
if the built-in video players of the Guacamole client should be
used.