mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-44: Expose tunnel UUID to JavaScript. Document allowed internal use of the empty opcode.
This commit is contained in:
@@ -33,6 +33,16 @@ import org.apache.guacamole.io.GuacamoleWriter;
|
||||
*/
|
||||
public interface GuacamoleTunnel {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
static final String INTERNAL_DATA_OPCODE = "";
|
||||
|
||||
/**
|
||||
* Acquires exclusive read access to the Guacamole instruction stream
|
||||
* and returns a GuacamoleReader for reading from that stream.
|
||||
|
@@ -36,6 +36,7 @@ import org.apache.guacamole.io.GuacamoleWriter;
|
||||
import org.apache.guacamole.net.GuacamoleTunnel;
|
||||
import org.apache.guacamole.GuacamoleClientException;
|
||||
import org.apache.guacamole.GuacamoleConnectionClosedException;
|
||||
import org.apache.guacamole.protocol.GuacamoleInstruction;
|
||||
import org.apache.guacamole.protocol.GuacamoleStatus;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -149,6 +150,12 @@ public abstract class GuacamoleWebSocketTunnelEndpoint extends Endpoint {
|
||||
|
||||
try {
|
||||
|
||||
// Send tunnel UUID
|
||||
remote.sendText(new GuacamoleInstruction(
|
||||
GuacamoleTunnel.INTERNAL_DATA_OPCODE,
|
||||
tunnel.getUUID().toString()
|
||||
).toString());
|
||||
|
||||
try {
|
||||
|
||||
// Attempt to read
|
||||
|
Reference in New Issue
Block a user