jsdo synchronous xmlhttprequest - Forum - Mobile - Progress Community

jsdo synchronous xmlhttprequest

 Forum

jsdo synchronous xmlhttprequest

  • Thanks for the explanation. I hope though something will be done to reduce the number of roundtrips (that is my standpoint as appdeveloper, I want to offer an optimal ux).

    Regards, Stefan.

  • Not synchronous, not asynchronous, but simultaneous. :-)

  • Regarding the multiple round trips, what are the requests that you see being made? You referred to fetching home.html 3 times -- do you see three GET requests for home.html?

  • That's right Wayne.

  • Hi Stefan,

    Hmm. We don't deliberately do three GETs of home.html for a login, so I am very interested in the case where you see it, in case there is something we need to do about it. If you can send me a code sample that shows your login sequence, as well as a screen capture or dump of the network traffic (from a browser debugger Network tab, or Fiddler, or something similar), I'll take a look.

    I will say that if you are using Form-based authentication and CORS, there is always more traffic than might be expected. In that case, you'd see both an OPTIONS request and a GET request of home.html, and then an OPTIONS request and a POST for j_spring_security_check, all as part of the login. And there would be an OPTIONS and a GET for a ping that we do after login. But these would not show up as three GETs of home.html.

    Regards,

    Wayne

  • I'll try to make time tomorrow. Nothing special in any case.

    Regards, Stefan.

  • Hi Wayne,

    Here is the code:

     dataModel.configDatasource = function(config) {
            var session = new progress.data.Session(),
                loginResult = session.login(config.crudServiceBaseUrl + "/" + config.service, "", "");
            session.addCatalog(config.crudServiceBaseUrl + "/" + config.service + "/static/mobile/" + config.service + ".json");
            dataModel.jsdo = new progress.data.JSDO({ name: config.datasource });
        };

    And here is the network tab:


     

    The three gets for home.html are not expensive, the three (related?) _oeping gets are more expensive (when the test is repeated this looks true on avarage). Besides it is interesting for me to see how expensive the gets for pictures are. I replaced most of them with fontello fonts, the ones you see will be soon. The two customreads are a get for a first page of data + a get for info I need for the screen (only needed to initialize the screen). I will try to merge these (see https://community.progress.com/community_groups/mobile/f/17/t/16826.aspx last message).

      Chrome btw is faster, in the networktab I can see fontello (not so in firefox). In the meantime I replaced one of the images with fontello.

     

    Regards, Stefan.

  • Thanks, Stefan. I'll take a look.

  • Hi Stefan

    Is there any possibility that dataModel.configDatasource() is being called three times?  What stands out about the Network traffic is that there is a GET of the catalog (CustomerService.json) right after the first request for home.html. Given the code in configDatasource (which looks fine), we would only see the request for the catalog after the login call is completely done executing and returns. That suggests that login was called, successfully got home.html (only requesting it once, at that point), returned, and then addCatalog was called. The two additional requests for home.html may mean that there actually were calls to login() (via 2 calls to configDatasource() ) two more times. (Even though that implies that addCatalog() would also be called twice more, you wouldn't see any repetition of the request for CustomerService.json because the Session code would detect that it had already fetched it and so doesn't send the request.)

    I did run your code against my own service (a Customer service using Anonymous authentication) and saw the same pattern of network traffic that you did, but only if I called configDatasource() three times.

    Regards,

    Wayne

  • Hi Wayne,

    You're right, I'm sorry I did not think of this myself before. I call it for the initial page of data, the validations and a foreign key. I can solve this by calling the foreign key service as soon as it is needed (select a fk the first time when doing mainentenance) and getting the validations with the initial page of data together (community.progress.com/.../16826.aspx last message as mailed a couple of messages ago).

    Regards, Stefan.