On Fri, Feb 16, 2018 at 6:18 AM, Amarjeet Singh <[email protected]>
wrote:

> Hi MIke,
>
> As suggested by you, I have implemented *SIMPLE PROOF-OF-CONCEPT  
> *applications
> which  stream over separate and differently-named static channels within
> the RDP session.
>
> *STATIC VIRTUAL CHANNEL NAME* : vEcho
>
> *PURPOSE *: Continuously sending data [ Hello ]   from Remote to Local
> Browser [ Guacamole Client ]  and receiving same  data [ Hello ] from Local
> Browser  [ Guacamole Client ]  to Remote.
>
> RESULT : *It stops sending data after few seconds* whereas It is working
> fine in *mstsc and *other HTML5 solutions.
>
>
> *Guacamole Client Implementation :*
>
> client.onpipe = function(input_stream, mimetype, name) {
>>
>> if (name == "*vEcho*"  ){
>>
>> var reader = new Guacamole.ArrayBufferReader(input_stream);
>> reader.ondata = function(buffer) {
>> var rdpdata = new Uint8Array(buffer);
>> var b64encoded = btoa(String.fromCharCode.apply(null, rdpdata));
>> console.log("Receiving Data :: Name of the Channel is : - ",name);
>> console.log("Data is : - ",b64encoded);
>> var output_stream = client.createPipeStream(mimetype, name);
>> var writer = new Guacamole.ArrayBufferWriter(output_stream);
>> console.log("Sending Data :: Name of the Channel is : - ",name);
>> console.log("Data is : - ",rdpdata.buffer);
>> *writer.sendData*(rdpdata.buffer);
>> };
>>
>> }
>>
>>
>> };
>
>
>
The code you have here will exhaust the number of available streams by
repeatedly creating new pipe streams which are never closed, one for each
blob of data received. You need to invoke writer.sendEnd() to release the
underlying stream when it will no longer be used. There is likely also no
need to create an entirely new stream each time data is received; it would
be more efficient to create the secondary pipe stream only once within
onpipe, reusing that stream while the original stream remains open.

- Mike

Reply via email to