
NodeQuery is a realtime server-side DOM API - funthree
https://github.com/tblobaum/nodeQuery
======
scarmig
Are there examples of this paradigm for another framework or in another
language?

We think of js as being of paramount importance in web development because
it's the only way to interact with the DOM, so we've mostly come to terms with
it and its flaws (which are manifold, even though I happen to think it's a
nice language in lots of ways). But if we put all DOM manipulation on the
server-side with a very thin client-side javascript communication and
manipulation layer, this isn't necessary.

You could write your entire application in Ruby, Haskell, Forth, whatever
floats your boat, against a standardized, cross-browser, and improved DOM.

This is powerful and intriguing.

~~~
jimrhoskins
I could be wrong but I think ICEfaces [1] for Java does something like this. I
remember seeing a presentation on it at a Rails vs Django vs Java "debate" a
few years ago.

It may not be quite the same thing, and I can't really parse the website very
well for how it really works. I do remember it holds a copy of the DOM server
side then manipulates it over HTTP.

So if you want it in Java, there's that.

[1]<http://www.icefaces.org/main/home/>

------
kylemathews
Why would you want to add 100-500ms of latency to every single DOM
manipulation? Realtime means I click on something and something else happens,
immediately, not a 1/2 second later.

All this to just save having to load jQuery in the client? Not sure I get the
advantage.

~~~
scarmig
You still have to load jQuery through the client. What it does is expose RPC.

So in your situation I'd believe what you'd see is the server sending the
command to attach event handlers to the elements you're clicking before you
start interacting with it.

------
clickerly
This appears to solve a major problem with web apps - exposing your entire
front-end code to everyone. Very exciting.

Is it production ready? (Edit: Duh, says "beta")

------
pedalpete
can somebody provide a real-world example where you'd want to manipulate the
DOM from the server?

I'm not sure I really see the benefit of this. Not to say it isn't cool, just
wondering where it would be useful over client-side DOM.

My understanding of node is that the benefit is in the lack of thread locking,
not specifically that it runs javascript.

~~~
funthree
There are a number of reasons why you might want to use jquery directly from
the server. Some off the top of my head...

-You can keep your application code hidden from prying eyes

-You only serve up ~120kb of javascript to the client no matter how intense your application is

-You can get better response times for realtime games and apps since what your user is doing is tightly coupled with what actually needs to react (the server).

-You can write 3,000,000 or 10 lines of application logic and it will not affect the speed of the client's device.

One flaw is (potentially) in coming up with a new way to cache redundant
requests properly.

~~~
cobrabyte
I think points 1 and 2 are pretty strong. I've always felt reluctant about
having your entire code base available to whoever opens the JS file. Maybe I'm
just paranoid.

The real strength is reducing the transfer size. You're only sending what's
needed by the client. Nice stuff, if it works as-advertised.

~~~
funthree
Also noteworthy is the new ability to treat the DOM as a resource from the
server point of view. Extracting information and rendering view partials in
realtime as well as placing event listeners for the DOM on the server can help
get things done quite a bit faster. This is especially true since you can now
work with the DOM near the scope of other server-side only resources making it
easier to create prototypes and apps that have a high level of user
interaction with them.

------
jessedhillon
Initial reaction: issuing server-side calls to manipulate client-side DOM is a
gross violation of the principles of separation of logic/duties. Why is this
desirable?

~~~
snorkel
This allows the client-server to communicate lower level interaction details
in realtime. Seems quite be useful for realtime multiuser apps.

------
equark
What is limiting this to be jQuery/Zepto specific? Is it possible to write a
generic server-side remote control so that other libraries can be used?

------
jonpaul
Thank you for this. jsDom was the only other server side DOM implementation,
and it's garbage (buggy).

~~~
klaruz
This is not a server side DOM. It's an rpc system that acts like a jquery
remote control.

~~~
nailer
That's an awesome summary - they should use it on the site.

