Jan 25th, 2012, 09:47 AM
Where to start with UI push...
I am writing a web app in Roo that has some need to have messages pushed to the browser. In reading around, it seems that Dojo has some pretty nice built-ins to handle the UI-side of sending/receiving messages, but I am struggling to find any information on the server-side integration.
I have found stuff talking about Cometd, which I understand isn't any sort of implementation but rather an "idea", as much as AJAX is an "idea", and read about Atmosphere. I don't, however, see any add-ons for Roo that include such integration, nor have I found any blog posts or examples.
So, from a Spring Roo standpoint, what are the options for implementing a UI messaging framework? At this point, I would be happy just to have something to start Googling for, or the name of a good book to pick up that might have some insight.
Right now, I am trying to do a "poor-man's" push by simply having an Spring MVC controller method loop until something gets written to a table. Obviously, this is not a good way to do things, but I don't seem to know what options are out there. JMS would be an obvious choice, but then how do you convert that to some "message" sent to the client?
Any guidance would be much appreciated!
Jan 27th, 2012, 08:13 AM
Can anyone give me some guidance on UI Push/Reverse AJAX, or whatever it's "officially" called?
Jan 27th, 2012, 08:26 AM
This suggestion is very simple and -easy to implement- but it works for sure...
Just write a little piece of JS that periodically queries your server for new messages.
I hope it works for you
Jan 30th, 2012, 09:32 AM
Yeah, this was my "brute-force" backup plan, but doesn't really satisfy the push requirement. I know there are ways to do it, and I am honestly not looking for solutions, rather just some guidance on where to look myself.
I did find in the Atmosphere GIT repo an example of using Spring MCV with Atmosphere. I had also read somewhere that someone was putting together an addon to do Atmosphere in Spring Roo. My only hold-up right now is I don't want to go down the road of manually integrating Atmosphere only to find out someone already did the work and made a simple addon. I rather like Roo's various integrations, as they are typically done in a much cleaner, smarter fashion than I ever would manually. Call it years of experience vs. slapping crap together based on some blog posting.
Anyway, I will most likely tackle the Atmosphere thing soon. It looks like its a matter of setting up a simple servlet w/ dispatcher in the web.xml, and it appears that you can use JMS as the messaging framework on the server-side. My only question is whether or not Dojo can use Atmosphere or not straight out of the box. Also, I am not sure how the WebSockets plays in here...its seems that Atmosphere supports it, but I am not sure how they actually "work". This goes back to my original request for guidance...is there some source that may explain this stuff so that I can understand what I am doing and not just copy/pasting stuff.
Anyway, if I get things working, perhaps I will post a solution here or others.
Jan 30th, 2012, 11:22 AM
I agree... there is not many solutions on Atmosphere or other push libraries working with Roo out there...
I am adding the topic -to my to list- for writing a "solution" -and post a blog article- in the near future. I am going to use jQuery as the JS client library in my case.
Last edited by delgad9; Jan 30th, 2012 at 11:37 AM.