You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by Mike Jumper <mi...@guac-dev.org> on 2017/05/18 19:17:43 UTC

[DISCUSS] Handling of "ack" within guacamole-common-js *Reader implementations (Was: Perhaps the longest email subject I've ever seen)

Hi all,

As Frode pointed out on the user@ list [1], the BlobReader implementation
does not automatically send the initial "ack" required for streams.
Depending on perspective, this may or may not be a bug. At the very least,
it's undocumented.

The "ack" instruction was not strictly required in the past, but it is now
required at least for file transfer due to the changes made in GUACAMOLE-44
[2].

From the above, it's clear that there are at least two issues with the
current streaming subsystem:

1) It is not clearly documented which streams require explicit "ack"s, nor
that it's up to the guacd-side protocol implementation to require (or not
require) these "ack"s, and up to the JavaScript side to know whether to
send "ack"s.

2) The *Reader implementations in guacamole-common-js are inconsistent in
whether "ack"s are sent automatically, and that behavior is not documented
either.

Looking through the readers, the ack behavior is currently as follows:

ArrayBufferReader - does not send "ack" responses at all
BlobReader - sends "ack" responses for received "blob" instructions, but
does not send an initial "ack" for the start of the stream.
DataURIReader - does not send "ack" responses at all
JSONReader - does not send "ack" responses at all
StringReader - does not send "ack" responses at all

This protocol-level details of "ack" and the above behavior should at least
be documented, but given that sending "ack" doesn't hurt anything when not
required, I wonder if perhaps it would be better to simply have each
*Reader send automatic "ack"s by default, with an optional parameter in the
constructors for disabling that behavior.

Thoughts?

- Mike

[1]
https://lists.apache.org/thread.html/f7c733f61f6fefb3ba23a14bf9e3f6775e665789e868bf3b9d7300d4@%3Cuser.guacamole.apache.org%3E
[2] https://issues.apache.org/jira/browse/GUACAMOLE-44

---------- Forwarded message ----------
From: Frode Langelo <fr...@apache.org>
Date: Thu, May 18, 2017 at 9:05 AM
Subject: Re: We have a problem in our guacamole client implementation such
that we are not receiving onend notification when trying to read the
guacamole stream (So printing is not working)
To: user@guacamole.incubator.apache.org


odonya;

Can you try sending an ack "OK" after creating the BlobReader and adding
the event handler:

guac.onfile = function clientFileReceived(stream, mimetype, filename) {
    //this is called
    var blobReader = new Guacamole.BlobReader(stream, mimetype);
    blobReader.onend = function onend() {
        //this is never called
    }
    // Send ack or the download won't start
    stream.sendAck("OK", 0x0000);
}


--Frode



On Wed, May 17, 2017 at 11:13 PM, Mike Jumper <mi...@guac-dev.org>
wrote:

> The only thing that would cause "onend" to not be invoked is if the "end"
> instruction for the stream is never sent (which is unlikely). If you can
> confirm that normal Guacamole downloads the file as expected, then
> something else is likely happening here.
>
> Are you positive it's not being invoked? Could there me some other reason
> that the functionality within your onend handler is not behaving as
> expected?
>
> Any errors in the browser JavaScript console?
>
> - Mike
>
>
>
> On May 17, 2017 11:14, "odonya" <jo...@gmail.com> wrote:
>
> We have a problem in our guacamole client implementation such that we are
> not
> receiving onend notification when trying to read the guacamole stream.
>
> Our code snippet looks like this
>
>                  guac = new Guacamole.Client(
>                    tunnel
>                  );
>
>             This is how we are listening on onfile when we are trying to
> print file.
>
>
>             guac.onfile = function clientFileReceived(stream, mimetype,
> filename) {
>                    //this is called
>             var blobReader = new Guacamole.BlobReader(stream, mimetype);
>                 blobReader.onend = function onend() {
>                //this is never called
> }
> }
>
>
> My question is why is onend not being called?
> I am using 0.9.12-incubating  version of guacamole.
>
>
>
>
> --
> View this message in context: http://apache-guacamole-incuba
> ting-users.2363388.n4.nabble.com/We-have-a-problem-in-our-gu
> acamole-client-implementation-such-that-we-are-not-receiving
> -onend-notifi-tp974.html
> Sent from the Apache Guacamole (incubating) - Users mailing list archive
> at Nabble.com.
>
>
>

Re: [DISCUSS] Handling of "ack" within guacamole-common-js *Reader implementations (Was: Perhaps the longest email subject I've ever seen)

Posted by Frode Langelo <fr...@apache.org>.
I am in favor of the latter; have each Reader send automatic "ack"s by
default, with the optional parameter in the constructors for disabling
the behavior.

-- Frode

On Thu, May 18, 2017 at 12:17 PM, Mike Jumper <mi...@guac-dev.org> wrote:
> Hi all,
>
> As Frode pointed out on the user@ list [1], the BlobReader implementation
> does not automatically send the initial "ack" required for streams.
> Depending on perspective, this may or may not be a bug. At the very least,
> it's undocumented.
>
> The "ack" instruction was not strictly required in the past, but it is now
> required at least for file transfer due to the changes made in GUACAMOLE-44
> [2].
>
> From the above, it's clear that there are at least two issues with the
> current streaming subsystem:
>
> 1) It is not clearly documented which streams require explicit "ack"s, nor
> that it's up to the guacd-side protocol implementation to require (or not
> require) these "ack"s, and up to the JavaScript side to know whether to
> send "ack"s.
>
> 2) The *Reader implementations in guacamole-common-js are inconsistent in
> whether "ack"s are sent automatically, and that behavior is not documented
> either.
>
> Looking through the readers, the ack behavior is currently as follows:
>
> ArrayBufferReader - does not send "ack" responses at all
> BlobReader - sends "ack" responses for received "blob" instructions, but
> does not send an initial "ack" for the start of the stream.
> DataURIReader - does not send "ack" responses at all
> JSONReader - does not send "ack" responses at all
> StringReader - does not send "ack" responses at all
>
> This protocol-level details of "ack" and the above behavior should at least
> be documented, but given that sending "ack" doesn't hurt anything when not
> required, I wonder if perhaps it would be better to simply have each
> *Reader send automatic "ack"s by default, with an optional parameter in the
> constructors for disabling that behavior.
>
> Thoughts?
>
> - Mike
>
> [1]
> https://lists.apache.org/thread.html/f7c733f61f6fefb3ba23a14bf9e3f6775e665789e868bf3b9d7300d4@%3Cuser.guacamole.apache.org%3E
> [2] https://issues.apache.org/jira/browse/GUACAMOLE-44
>
> ---------- Forwarded message ----------
> From: Frode Langelo <fr...@apache.org>
> Date: Thu, May 18, 2017 at 9:05 AM
> Subject: Re: We have a problem in our guacamole client implementation such
> that we are not receiving onend notification when trying to read the
> guacamole stream (So printing is not working)
> To: user@guacamole.incubator.apache.org
>
>
> odonya;
>
> Can you try sending an ack "OK" after creating the BlobReader and adding
> the event handler:
>
> guac.onfile = function clientFileReceived(stream, mimetype, filename) {
>     //this is called
>     var blobReader = new Guacamole.BlobReader(stream, mimetype);
>     blobReader.onend = function onend() {
>         //this is never called
>     }
>     // Send ack or the download won't start
>     stream.sendAck("OK", 0x0000);
> }
>
>
> --Frode
>
>
>
> On Wed, May 17, 2017 at 11:13 PM, Mike Jumper <mi...@guac-dev.org>
> wrote:
>
>> The only thing that would cause "onend" to not be invoked is if the "end"
>> instruction for the stream is never sent (which is unlikely). If you can
>> confirm that normal Guacamole downloads the file as expected, then
>> something else is likely happening here.
>>
>> Are you positive it's not being invoked? Could there me some other reason
>> that the functionality within your onend handler is not behaving as
>> expected?
>>
>> Any errors in the browser JavaScript console?
>>
>> - Mike
>>
>>
>>
>> On May 17, 2017 11:14, "odonya" <jo...@gmail.com> wrote:
>>
>> We have a problem in our guacamole client implementation such that we are
>> not
>> receiving onend notification when trying to read the guacamole stream.
>>
>> Our code snippet looks like this
>>
>>                  guac = new Guacamole.Client(
>>                    tunnel
>>                  );
>>
>>             This is how we are listening on onfile when we are trying to
>> print file.
>>
>>
>>             guac.onfile = function clientFileReceived(stream, mimetype,
>> filename) {
>>                    //this is called
>>             var blobReader = new Guacamole.BlobReader(stream, mimetype);
>>                 blobReader.onend = function onend() {
>>                //this is never called
>> }
>> }
>>
>>
>> My question is why is onend not being called?
>> I am using 0.9.12-incubating  version of guacamole.
>>
>>
>>
>>
>> --
>> View this message in context: http://apache-guacamole-incuba
>> ting-users.2363388.n4.nabble.com/We-have-a-problem-in-our-gu
>> acamole-client-implementation-such-that-we-are-not-receiving
>> -onend-notifi-tp974.html
>> Sent from the Apache Guacamole (incubating) - Users mailing list archive
>> at Nabble.com.
>>
>>
>>