473,574 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX/stale browser data/polling vs. server push/drag and drop

Hi,

I am trying to put together the last major pieces of my project's
puzzle[1]. This is more website/client-side architecture than
JavaScript syntax but I hope this is a good place to ask. I'm a little
stumped with which direction to take and advice would be greatly
appreciated. I think this is a generally interesting problem but I
haven't seen a post this long here before :S

I have developed half of the admin interface for an e-commerce
website[2]. After the admin page is initially loaded in the browser,
the browser never again will do a full page reload. It is all AJAX to
make the changes. This can lead to stale browser data when there are
multiple users. Stale data can occur even if there was no AJAX
involved. Multiple users could just mean one storefront customer and
one administrator but for the example below I am thinking of two
administrators.

This example is similar to multiple windows open in OS X Finder,
Windows Explorer, etc. A change in one window can cause an update in
other windows where appropriate. One difference is that, for a website,
calls to the server are expensive.

EXAMPLE

A category has many products. On the administration page, the order
that products appear in a category can be changed. Each item in the
list can be repositioned using drag and drop. Also, it is possible to
see multiple categories simultaneously in different panes. Imagine

-----------------------------------------------------------
| Category A | Category A | Category B |
| | | |
| Prod 1 | Prod 1 | Prod 4 |
| Prod 2 | Prod 2 | Prod 5 |
| Prod 3 | Prod 3 | Prod 6 |
-----------------------------------------------------------

I could do the following.

A user (i.e. administrator) wants to move Prod 3 to a new position in
category A's list. When the drag is initiated the user is actually
dragging a clone of Product 3. He can drop the clone into a new
position higher in the list. The clone is in brackets.

-----------------------------------------------------------
| Category A | Category A | Category B |
| | | |
| Prod 1 | Prod 1 | Prod 4 |
| [Prod 3] | Prod 2 | Prod 5 |
| Prod 2 | Prod 3 | Prod 6 |
| Prod 3 | | |
-----------------------------------------------------------
After the drop, the client sends an AJAX request to the server seeking
approval for this move. The server replies saying the move is ok and
the database has been updated. The client can now make the move final.

-----------------------------------------------------------
| Category A | Category A | Category B |
| | | |
| Prod 1 | Prod 1 | Prod 4 |
| Prod 3 | Prod 2 | Prod 5 |
| Prod 2 | Prod 3 | Prod 6 |
-----------------------------------------------------------

First problem, the second panel is now stale.

Second problem, when the other administrator makes a change, I am
stale. He may make many changes very fast.

I could have my client poll the server every minute and find out what
has changed in the database. The client could ask the various panels
"Do you want to be updated?" and collect a list of interested panels.
Then send an AJAX request for the updates and do the updates with the
response (eg. DOM insertion, innerHTML[3], or other). To improve
things, every time I make a request any other new updates could piggy
back on the response.

I could use the new style of Flash sockets mixed with JavaScript so the
server can push data to the client[4]. I don't really like the idea of
using Flash because it is not a standard. I don't know if flash will be
available on a cell phone as soon as a browser with JavaScript and CSS.
If I require flash I may as well go all the way with a flash admin
site.

I am not interested in Comet [5].

I'm sure an increasing number of people will encounter this over the
next couple years. To a certain degree, I feel like developing a rich
browser app with HTML/CSS/JavaScript is still in the dark ages compared
to the Flash world or a dedicated Java desktop app that communicates
with the server.

Any advice?

Thank you,
Peter
[1] http://trac.vaillant.ca/store.rb/

[2] If you are interested you can see a partly working demo at
http://characters.michaux.ca/admin. In the menus you can try
Catalog>New Window and Category>Yahoo! Test. You can open multiple
windows and move them around. I think it is good to see the desktop
metaphor in a website.

[3] I know, not standard. Just an example here.

[4] http://en.wikipedia.org/wiki/COMET_(programming)

[5] http://www.aflax.org/examples/sockets/sockets.html

May 7 '06 #1
3 5894
pe**********@gm ail.com wrote:
Hi,

I am trying to put together the last major pieces of my project's
puzzle[1]. This is more website/client-side architecture than
JavaScript syntax but I hope this is a good place to ask. I'm a little
stumped with which direction to take and advice would be greatly
appreciated. I think this is a generally interesting problem but I
haven't seen a post this long here before :S

I have developed half of the admin interface for an e-commerce
website[2]. After the admin page is initially loaded in the browser,
the browser never again will do a full page reload. It is all AJAX to
make the changes. This can lead to stale browser data when there are
multiple users. Stale data can occur even if there was no AJAX
involved. Multiple users could just mean one storefront customer and
one administrator but for the example below I am thinking of two
administrators.


Try "Reverse Ajax" using DWR:

http://getahead.ltd.uk/dwr

(Assuming it's a Java server)
May 7 '06 #2

TheBagbournes wrote:

Try "Reverse Ajax" using DWR:

http://getahead.ltd.uk/dwr

(Assuming it's a Java server)


Thanks but it is a Rails app. "Reverse Ajax" is just polling, correct?

May 7 '06 #3
pe**********@gm ail.com wrote:
TheBagbournes wrote:
Try "Reverse Ajax" using DWR:

http://getahead.ltd.uk/dwr

(Assuming it's a Java server)


Thanks but it is a Rails app. "Reverse Ajax" is just polling, correct?


I assume so, but there's slightly more. If I read it right, The DWR
servlet tracks all sessions which turn polling on, so that from the
server, you can "broadcast" script to all pages by URL.

Pretty nifty. So alerts for system events, diary notifications etc can
be popped up just as well as local apps can.

Nige
(from the Y!UI user group)
May 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2327
by: Yarco | last post by:
I want to use "Ajax" to create my web for hobby. But i don't know whether "Ajax" is mature... And what about with php? Someone have experience on it? ....
3
2771
by: Oscar Thornell | last post by:
Hi, I am looking for a technique where you from the serverside push/update a standard web browser with small piceces of data. An exempel could be sports result or stock exchange information. I do not want to use Java Applets, ActiveX controls or force the clients to download .NET Assemblies (and install the .NET Runtime...) If at all...
17
13170
by: petermichaux | last post by:
Hi, Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server. Thanks, Peter
1
2412
by: kelvin.jones | last post by:
Hi guys, I have read several discussions on this group (and others) that talk about polling a server using ajax transactions and if it is possible to push to the client. The general consensus seems to be "no, there is no way to push to client using ajax, you have to poll." Knowing this, I assumed meebo.com and gmail talk are using the same...
31
3102
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked around here? If so, do you know if Ajax.NET can be used without prototype.js? -- "The most convoluted explanation that fits all of the made-up...
8
2081
by: jason.m.ho | last post by:
>From the common user perspective (like my grandma), why would they care if its a java applet or an ajax application? Say I want to make a chat system on my website...If i'm doing really involved Comet push-style data communication, and rendering everything using DHTML, why would users prefer that over a java applet? Moreover, say I use a...
1
16488
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX - microlink pattern tutorial : A microlink is a link that opens up
25
2533
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e. every 5 seconds, i just want to refresh it ONLY on server change just like desktop applications do. The problem is that refreshing evry n seconds has...
5
3332
by: Tem | last post by:
Does anyone know how web-based chat like Gtalk in gmail works? how come it doesn't need to constantly refresh/send a request to the server to get new message? other web based chat room have to constantly refresh the page (every 10 sec) to get new messages Tem
0
7828
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8089
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6493
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5329
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3765
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1092
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.