mojito icon indicating copy to clipboard operation
mojito copied to clipboard

HTML5App looking for "POST /tunnel"

Open gvaish opened this issue 11 years ago • 12 comments

Wonder if HTML5App should look for "/tunnel" even if there are no components with any server affinity?

gvaish avatar Mar 28 '13 06:03 gvaish

Can you elaborate more? Tunnel will not work with an offline app.

caridy avatar Mar 28 '13 14:03 caridy

@caridy Bingo. I assumed/expected the same :-)

Basically, what I was looking at is - if I have mojits that have either common or client affinity controllers only, can Mojito work without making a call to "/tunnel" to fetch the components (views, model, controller etc).

I guess it doesn't make too much sense for this case...

gvaish avatar Mar 28 '13 14:03 gvaish

Well, the "referenced issue" is - https://github.com/addyosmani/todomvc/pull/507

gvaish avatar Mar 28 '13 14:03 gvaish

I'm not so sure I follow. Views, Models and Controllers are just YUI modules setting in the static folder when producing an offline app. They will be loaded when needed without any hazard. Aside from that, the definition/spec will be loaded from local as well since they will be precomputed and stored in disk. In other words, on demand mojits will/should work just fine. What will not work is the mojitProxy.invoke() if a component is a server side.

caridy avatar Mar 28 '13 14:03 caridy

@caridy The issue that I am seeing is that even though all components have "common" affinity (controller + model), the html5app code generated makes a call to /tunnel.

btw, the application is live at http://gvaish.github.com/todomvc-mojito/common/ Keep the firebug open and you'll notice two calls:

  1. /static/TodoMojit/definition.json?runtime=client&site=&device=&lang=en&langs=en%2Cen&region=&jurisdiction=&bucket=&flavor=&tz= -- this should have been /common/static/... -- wondering if this should be with query-params or .../definition.json only
  2. /tunnel -- why? Do I have a wrong config at https://github.com/gvaish/todomvc-mojito/blob/master/todomvc-mojito-common/application.json ?

Adding @isao

gvaish avatar Mar 31 '13 11:03 gvaish

@gvaish few comments:

  • /static/TodoMojit/definition.json?*** is just fine. Those querystring parameters will not play a role because that definition.json was already generated when you did mojito build html5app path/ --context whatver:something, so, they will be effectively ignored.
  • /tunnel calls should not be made under those conditions unless that a particular mojit is forcing controller to use server affinity.
  • If a call for definition.json fails, that's an indication that the mojit cannot run in the client side and the tunnel will be issued, and apparently that's what is going on here, because http://gvaish.github.com/static/TodoMojit/definition.json returns 404 for whatever reason.
  • this seems to be a problem with the relative path that has to be used in your app, if you hit this url for defintion: http://gvaish.github.com/todomvc-mojito/common/static/TodoMojit/definition.json?runtime=client&site=&device=&lang=en&langs=en%2Cen&region=&jurisdiction=&bucket=&flavor=&tz=, it works just fine. I will try to reproduce the issue later today.

caridy avatar Apr 01 '13 15:04 caridy

@gvaish I was able to reproduce the issue, and I found a couple of bugs in store-client that prevent the use of relative paths in HTML5 apps, I plan to fix it asap. I will commit against this issue.

caridy avatar Apr 01 '13 16:04 caridy

Trello card: https://trello.com/card/todomvc-gh1050-store-client-does-not-play-nicely-with-relative-static-handling-prefix/504e5e3b7cd1578456fc430f/474

caridy avatar Apr 01 '13 16:04 caridy

@caridy Cool. So, it seems the todomvc app has really served Mojito dev well :smile:

Will await the updates. Take your time!

gvaish avatar Apr 01 '13 16:04 gvaish

@caridy Is the Trello task done? I saw a notification

Jenny Donnelly checked Add missing tests to IDE integration suite [IDE no longer supported] on [todomvc][gh1050] store-client does not play nicely with relative static handling prefix on mojito-dev

But then the card went missing... Got curious.

gvaish avatar Apr 09 '13 03:04 gvaish

@gvaish we discussed the card today during a meeting, and we have decided to move it into another board where we are reworking mojito-next which is the next big iteration on mojito and its underlaying components. The reason why we moved there is because I have found some issues with the current implementation and fixing it might take longer that I was expecting which aligns better with the refactors that we are planing for mojito-next. In other words, this might get ready in 0.6.x but not in 0.5.x. Apologies for the inconveniences, and I will recommend you not to load dynamic mojits when running and html5 ap in the meantime. We can discuss more offline.

caridy avatar Apr 09 '13 07:04 caridy

@caridy Will ping you directly.

gvaish avatar Apr 13 '13 19:04 gvaish