Hello and thanks for the great module!
I would like to ask if it is possible to integrate this with Views so that a view either refreshes or new items are added when they become available by the node.js server? If yes are there any plans on doing this integration?

thanks!

Comments

julien’s picture

@christopher_skauss it is actually a great idea and work is in progress. I have a version of the module working to refresh the views blocks on each page as content is added in the backend. As it did need a bit of recode of the main nodejs server js file. I prefer not to commit it on the 7.x branch yet, as it still needs work.
You can give it a go here: https://git.liberal.co.nz/nodejs-drupal-7-views-integration
more infos here

julien’s picture

I also commited it on the 6.x branch. Thanks.

julien’s picture

Status: Active » Needs review
Anonymous’s picture

@julien - thanks for the work here. i think we need to touch base on the changes to server.js - i don't like the look of views stuff, as i'm pretty sure we should be able to handle this via content tokens.

will do a thorough review and post how i think we can do that in the next few days.

also, i'd like server.js to always be the same across branches. i'm doing the work necessary to register the node.js portions of this module as an npm installable extension in the nodejs-refactor branch, at which point all changes to node.js code will move off drupal.org and on to github.

julien’s picture

The D7 and D6 version of the nodejs_views module can be checked out here.
Just commited the same server.js version on the 6.x branch.

tizzo’s picture

I strongly feel that we want to use content tokens for views integration, server.js shouldn't need anything to work with it. In fact that was the motivator behind content channels, beejeebus wrote that stuff after we tried to sort out what we'd need for views integration.

After a quick look at the code, this appears to be built on a polling model and not a push model. It helps, but not a lot. I think we want to implement something similar to Cache Actions where the user has to set up their own rules for whose caches get cleared when. There's no way we can know whether a view can be refreshed once for all users or must be refreshed for each user (does it have a contextual filter for the currently logged in user? oh noes!).

Our solution should let site owners setup (via Rules) what events necessitate refreshing a view and whether we can push 1 re-rendered set of HTML to everyone viewing or whether we need to issue a "please reload this for yourself" command to the JS on the client side causing each one to load a new page out of Drupal directly (look out for cache stampedes...).

julien’s picture

Did commited a new version of this module on the 7.x branch. It is now using content token. I did add two other display for the views who wants to use nodejs. So for a view to refresh it has to get a display like nodejs block or nodejs page and configure the wrapper id in the configuration for each of those view.
I'm not too sure but i don't think that we can write a plugin for view that will add an option to the view edit ui form like "use ajax" or "use nodejs".
There is still a context links issue to fix tho.

rogical’s picture

Very existing features, views is now heavily used in mosts of sites.

The nodejs_views module seems not yet committed in drupal.org, hope to see it soon.

pribeh’s picture

Has tizzo or any maintainer of this module reviewed Julien's code yet? I have yet to really get node.js module up and running but am excited to deploy this soon. The views node.js submodule would be an excellent contrib that could arguably ship with the node.js module untill it gets overly complex. What say you maintainers?

julien’s picture

The context links issue is now fixed.
The code can be checkout here

Anonymous’s picture

will review this today.

julien’s picture

Thanks.

julien’s picture

Anyone else for the review ?

pribeh’s picture

Yes. I'm just getting the nodejs server setup :). Will report as soon as I can what my experience is.

julien’s picture

If someone have been using this nodejs views module, please send the feedback here. I would like to make this module part of the main nodejs module.
The guidelines from beejeebus regarding the channels have been followed, so we are not far from a stable version. Getting this one done will be a great feature as it is asked by users.

rlmumford’s picture

I haven't been using it, but am probably going to have a go today. From this conversation it looks like this integration triggers a refresh of the view, what I'm looking for is something that appends new results to the top of a list.

Any pointers for how I could go about implementing this?

julien’s picture

hello,

Understood the request, but if your view is configured to display the latest elements on top of the list (nodejs block or nodejs page display)
So the latest content appears on top of the list if your view is configured to do so.

jmstout’s picture

julien, excellent work on this integration.

I have tested and had success with both the nodejs page views, and block views in my dev environment.

The one issue I noticed, and perhaps you know this, was that when the two are combined, a nodejs view block is displayed on a nodejs view page, things stop working.

I've only tested this in a limited capacity, but have had enough success with the current codebase that I'm working on integrating it into a production site.

I think this would be a great addition to main module, and would love to see it get some more attention.

julien’s picture

Hey, first thanks for be one of the first who approve the work done on this. Even the previous owner of the project was not even capable of giving a proper answer on this.
The thing is when i develop my sites, usually, i only have one view in page mode, but never combined with another one in block mode. That's why you are having this issue. It's just the way i coded it, because it was serving the way i build the sites i'm working on.

julien’s picture

That won't be long to fix tho, i just need to find the time to put my hands into it. But yeah you're right, both should work

markwk’s picture

For anyone that missed the link reading through this (like me!): here is the link to the nodejs_view module: http://drupal.org/sandbox/julien/1502728. Really exciting integration point between views and nodejs!

broncomania’s picture

Thx for sharing this project. This is really awesome and I hope u can integrate it into the main module.

julien’s picture

I need to be sure that it's validated and working as expected first. Gonna ask people at the next drupal con if it's really worth it, because this module is still making apache request to deliver the html of the view. So you dont' really have the benefit of the contested performance of the nodejs server.

Anonymous’s picture

Project: Node.js integration »
Version: 7.x-1.x-dev »

setting correct issue queue.

dinle’s picture

Thanks.

julien’s picture

It is better to be a separated module from the main nodejs module. The main reason is that if you have, let's say several blocks in nodejs_view mode, and if your apache server is under traffic load, (i haven't done load test), but i'm pretty sure it will be a performance killer on the apache side, so it needs to be recoded, and find another way to let the nodejs server process get the html of the view by itself instead of using views_embed_view drupal api, for example.
mikl, gives maybe a better explanation here

Project: » Lost & found issues

This issue’s project has disappeared. Most likely, it was a sandbox project, which can be deleted by its maintainer. See the Lost & found issues project page for more details. (The missing project ID was 1502728)