• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Asynchronous user pop-up

New Here ,
May 03, 2010 May 03, 2010

Copy link to clipboard

Copied

Hey guys, long time since my last post here. This time i'm asking for some help in this task i need to complete.

I have a CFM-9 Application working perfect, the thing is that a customer asked me that he wants to get a pop-up or some kind of notification when a new line of info is added to a table in some specific SQL Server Database while he is interacting with the app without the need to refresh the page.

I've been having a look a the new ORM stuff but it looks like it's not the solution for what i need, i got the impression that i need to use AJAX for this stuff, ne idea if this can be actually even done in web applications?

Ideas, comments, feedback, links... ne info that helps me do this is good!

TOPICS
Advanced techniques

Views

754

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , May 03, 2010 May 03, 2010

Yes you could use the ColdFusion <CFAjaxProxy...> or other ColdFusion features that help you build AJAX functionally into your applications.

I feel important to note that these tools are just abstracting how one builds AJAX into wizards and auto-magically generated code.  This is all well and good and can be a great time saver.  But one should understand the realities going on under the hood so that one can better deal with unexpected behavior.

That admonition out of the way.  Yes you would use a

...

Votes

Translate

Translate
Valorous Hero ,
May 03, 2010 May 03, 2010

Copy link to clipboard

Copied

Well with normal HTTP web applications there is no way to push new data to a client.  Because the client does not remain connected to the server between requests so the server has no pipe to which it can push the data.

If you want true data push from server to client you need to use some technology beyond a basic http connection.  Adobe's tool for this type of feature is the Flex|Flash|Air client that maintains a connection to the server that data can be pushed through.

If you do not want to go into a Flex|Flash|Air, you will have to work with a client app that pulls the data with new requests on a regular cycle.  If you would like this request to be done behind the scenes so that the browser interface does not need to refresh for each request, then yes AJAX would be a common tool to allow behind the scene requests.

So yes, ColdFusion 9's new ORM feature is not going to provide any ability to pull or push the data to the client, though it could be very handy on the backend of the system where the data is getting pulled or pushed from.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 03, 2010 May 03, 2010

Copy link to clipboard

Copied

Thank you for your quick reply on this stuff Ian, actually i got a "not so nice" way to achieve this, and what i basically did was, just call the "SQL Table Watcher Page" from an iFrame and refresh just that iFrame every 2 seconds, the iFrame it self is 0px X 0px and it will show me a javascript alert with a "Yes" or "No" options every time there is a new row in that table... not exactly what i was looking for but it works.

Ne way, this is the "Fast and dirty" solution, but i want to use ajax one, where should i start investigating the way to do the Asynchronous push or pull to the client?, basically i need some sort of "task" to run this query every 2 seconds and push (or pull) the info to the client.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 03, 2010 May 03, 2010

Copy link to clipboard

Copied

Your down and dirty way is another way to have the client make new requests for new data on specified cycle.  I.E. a data pull model.

The thing about it is that the difference between your inline frame method and an 'AJAX' method is what makes the requests.  In AJAX the request is made with the JavaScript xmlHTTPReqest() function [http://www.w3schools.com/xml/xml_http.asp].  Other then some minor implementation differences conceptually this works the same as your inline method.  A piece of the browser makes a request to the server, the server responds, and the browser does something with the response sent from the server.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 03, 2010 May 03, 2010

Copy link to clipboard

Copied

For what i've been reading this can be done using cfajaxproxy, the thing is this... how can i use that proxy based on a timer? some sort of javascript infite loop?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 03, 2010 May 03, 2010

Copy link to clipboard

Copied

Yes you could use the ColdFusion <CFAjaxProxy...> or other ColdFusion features that help you build AJAX functionally into your applications.

I feel important to note that these tools are just abstracting how one builds AJAX into wizards and auto-magically generated code.  This is all well and good and can be a great time saver.  But one should understand the realities going on under the hood so that one can better deal with unexpected behavior.

That admonition out of the way.  Yes you would use a JavaScript timer [http://www.w3schools.com/js/js_timing.asp] script to repeatedly call the JavaScript function that is doing the AJAX xmlHTTPRequest() calls.  This script maybe auto-generated by the ColdFusion wizardry so you will need to snoop into the source of the files created for you application to sniff out what function might need to be called by your timer() script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 03, 2010 May 03, 2010

Copy link to clipboard

Copied

LATEST

Very "illuminating" info 

Thnx a ton!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation