Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One form of jsonCall not working in Comet context #1891

Open
dmclean62 opened this issue Aug 2, 2017 · 1 comment
Open

One form of jsonCall not working in Comet context #1891

dmclean62 opened this issue Aug 2, 2017 · 1 comment

Comments

@dmclean62
Copy link
Contributor

dmclean62 commented Aug 2, 2017

Mailing List thread

No example project available.

When using this form of jsonCall:

def jsonCall(jsCalcValue: JsExp, jsonContext: JsonContext, func: (JValue) ⇒ JValue): GUIDJsExp 

When "func" is called in a comet context, the client receives an empty response.

Antonio said:

Got it. This is the interaction of https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/http/CometActor.scala#L934
with https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/http/LiftServlet.scala#L637,
which means that a JsonResponse isn't ever generated correctly from a CometActor.

That's going to be a doozy to fix… We may end up wanting to push notices via the comet
response while pushing JSON via the AJAX response. But always doing that could result
in strange ordering issues, and sometimes doing that could lead to lack of clarity about when
that will happen vs not.

Will ponder it a bit; can you open an issue?

@Shadowfiend
Copy link
Member

The basic question here is what we do when we have a JValue bundled with a JsCmd in the return value of liftSession.runParams. This seems like it's mostly a concern in comet actors, but we'll need to confirm that. One observation is that in this particular context, we are likely always returning only S.noticesToJsCmd, because of the mixed nature of the response data that comes back from runParams. So changing this behavior may take us from not really returning anything to returning something, which is much less potentially-breaking than other changes we could make.

For the comet case specifically, we see the comet actor line also appends LiftRules.noticesToJsCmd. However, since the notice stuff in S uses TransientRequestVars, I think any notice set in the comet would be invisible once we get back out of the comet and into LiftServlet's handling. IF that is true, that means LiftRules.noticesToJsCmd will always be empty in LiftServlet, which means a mixed JSON + notices return from the comet would always result in an empty response.

Some assumptions to be verified there, but we may be able to make a fix to this that is “additively backwards compatible”, which is to say it doesn't lose any data that wasn't already being lost before this. It could still result in changed behavior if somehow folks were relying on that data being lost, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants