new Tunnel()
Core object providing abstract communication for Guacamole. This object
is a null implementation whose functions do nothing. Guacamole applications
should use Guacamole.HTTPTunnel instead, or implement their own tunnel based
on this one.
- Source:
- See:
Members
(static, constant) INTERNAL_DATA_OPCODE :String
The Guacamole protocol instruction opcode reserved for arbitrary internal
use by tunnel implementations. The value of this opcode is guaranteed to be
the empty string (""). Tunnel implementations may use this opcode for any
purpose. It is currently used by the HTTP tunnel to mark the end of the HTTP
response, and by the WebSocket tunnel to transmit the tunnel UUID and send
connection stability test pings/responses.
Type:
- String
(static) State
All possible tunnel states.
receiveTimeout :Number
The maximum amount of time to wait for data to be received, in
milliseconds. If data is not received within this amount of time,
the tunnel is closed with an error. The default value is 15000.
Type:
- Number
state :Number
The current state of this tunnel.
Type:
- Number
unstableThreshold :Number
The amount of time to wait for data to be received before considering
the connection to be unstable, in milliseconds. If data is not received
within this amount of time, the tunnel status is updated to warn that
the connection appears unresponsive and may close. The default value is
1500.
Type:
- Number
uuid :String
The UUID uniquely identifying this tunnel. If not yet known, this will
be null.
Type:
- String
Methods
connect(data)
Connect to the tunnel with the given optional data. This data is
typically used for authentication. The format of data accepted is
up to the tunnel implementation.
Parameters:
Name | Type | Description |
---|---|---|
data |
String | The data to send to the tunnel when connecting. |
disconnect()
Disconnect from the tunnel.
isConnected() → {Boolean}
Returns whether this tunnel is currently connected.
Returns:
true if this tunnel is currently connected, false otherwise.
- Type
- Boolean
sendMessage(…elements)
Send the given message through the tunnel to the service on the other
side. All messages are guaranteed to be received in the order sent.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements of the message to send to the service on the other side of the tunnel. |
Events
onerror
Fired whenever an error is encountered by the tunnel.
Parameters:
Name | Type | Description |
---|---|---|
status |
Guacamole.Status | A status object which describes the error. |
oninstruction
Fired once for every complete Guacamole instruction received, in order.
Parameters:
Name | Type | Description |
---|---|---|
opcode |
String | The Guacamole instruction opcode. |
parameters |
Array | The parameters provided for the instruction, if any. |
onstatechange
Fired whenever the state of the tunnel changes.
Parameters:
Name | Type | Description |
---|---|---|
state |
Number | The new state of the client. |