locked
[Javascript help]How to implement message listener on Client by using loadasync()

    Question

  • Hi guys,

         I am doing the work to implement a message listener on Client by using loadasync(). Multiple messages are allowed to be sent to server, and we need a message listener to receive all responses.

        Currently my implementation is as below:

        MsgListener = function(reader) {

           reader.loadAsync(10240).done(function(size) {

               // blabla

                WinJS.Promise.timeout().done(function () {return MsgListener(); });

           }, onError);

        }

       So I use WinJS.Promise.timeout() to loop loadAsync(). However, I've found that a response message from server will be divided into 4 parts from the second response.

        Could you please share another approach to me? Thanks.


    No pains, no gains.

    Friday, October 19, 2012 1:24 PM

Answers