I’m interested in inspecting the text output from the terminal. If I have an active SSH or Telnet connection the events onpipe, ontext, and ondata don’t seem to fire. They looked like possibilities since they return an inputstream, a string, and a buffer respectively. I was thinking something like the below would gain access to the server stream from the client.
guacClient.onpipe = function(input_stream, mimetype, name) {
reader = new Guacamole.StringReader(input_stream);
reader.ontext = function receiveText(text) {
console.log(text);
};
}
If I understand your comment below, the above events only fire in response to
Guac instructions received from the Guac server. So, I assume these events are
not associated with terminal’s output. Is it possible for the client to access
the terminal output at either the javascript or java layer?
Regards,
Jeff
From: Mike Jumper <[email protected]>
Reply-To: "[email protected]" <[email protected]>
Date: Saturday, February 17, 2018 at 1:29 PM
To: "[email protected]" <[email protected]>
Subject: EXT: Re: Working with pipes
On Fri, Feb 16, 2018 at 2:46 PM, McRoy, Jeffrey (GE Healthcare)
<[email protected]> wrote:
Hi Everyone,
I’m looking at how pipes work with the Guac client. For example…
.
.
// Instantiate client, using an HTTP tunnel - tenet connection
var guac = new Guacamole.Client(
new Guacamole.HTTPTunnel("tunnel")
);
var stream = guac.createPipeStream("text/plain", "response");
.
.
guac.onpipe = function(input_stream, mimetype, name) {
console.log("onpipe");
if (name == "response") {
reader = new Guacamole.StringReader(input_stream);
reader.ontext = function receiveText(text) {
console.log(text);
};
}
}
.
.
The client makes a successful telnet connection and the I’m able to use it.
However, I never see anything echoed to the Javascript console. I’m fairly sure
onpipe is supposed to fire whenever a pipe is created. In my example it seems
like onpipe does not execute. Is this the correct usage?
Nope. There is a distinction between createPipeStream() and onpipe:
createPipeStream() creates an outbound pipe stream from client to server. It
sends a "pipe" instruction [1] declaring the stream with the parameters given,
and the handlers of that stream object will be invoked in response to
instructions received from the server. Data ("blob" instructions [2]) is sent
strictly from client to server. In this case, as the telnet protocol support
does not attempt to handle inbound pipe streams, this will most likely result
in an "ack" [3] with an associated error code, implicitly closing the stream.
If the code you've provided here is exactly what you are doing, it's also
likely that doing this has no real effect, since the tunnel will not be open at
the time that the "pipe" instruction needs to be sent, and the outbound
instruction will simply be dropped by the tunnel implementation.
The onpipe handler, on the other hand, is invoked in response to an *inbound*
pipe stream from server to client. This occurs when a "pipe" instruction is
sent by the server. It will not be invoked as a direct result of functions that
you call on the client-side; this and other handlers on the Guacamole.Client
object deal only with received Guacamole instructions.
- Mike
[1] http://guacamole.apache.org/doc/gug/protocol-reference.html#pipe-instruction
[2] http://guacamole.apache.org/doc/gug/protocol-reference.html#blob-instruction
[3] http://guacamole.apache.org/doc/gug/protocol-reference.html#ack-instruction
smime.p7s
Description: S/MIME cryptographic signature
