Is this possible? (server to user) (AJAX)

  • WritingBadCode
  • Graduate
  • Graduate
  • User avatar
  • Posts: 214
  • Loc: Sweden

Post 3+ Months Ago

I don't have the best understanding of AJAX but as I understand it it work by having the user send a small request and then the server (probably) respond with something. Then this is usually repeated when the user does something or it can also use a timer to ask the server "Hey is there anything new that I can add to this users experience?".

Anyway lets say I got some site that isn't updated too often then many small requests each x time coming from each user could end up tearing on the server load. So is it possible to have it work the other way around so the server contact the user when it got new information and only then? (Maybe by storing some user info and "ping them" once there is something new to add).
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • may
  • Proficient
  • Proficient
  • User avatar
  • Posts: 328
  • Loc: Holland [NL]

Post 3+ Months Ago

Hi There,

I have build a simple "draw" script using ajax and php. YOu can download the source here, maybe it will help you understand the XHTTP request (ajax) calls.

http://sysengineers.wordpress.com/2011/ ... ttp-mysql/

It is a working example that requires a mysql table with a blob and a php enabled webserver. It will allow one to click inside a image, and the http page will then call the XHTTP object to send a draw instruction to a php file that will draw in the given coords, update the image and save it in database. Then when the request is done, the jscript will update the image dynamically showing the dot drawn and allowing the user to draw the next dot inside the image and so on..

Hope it helps, understanding and testing :)
  • may
  • Proficient
  • Proficient
  • User avatar
  • Posts: 328
  • Loc: Holland [NL]

Post 3+ Months Ago

On the question the other way around, the answer is no.

This would suggest that the remote user is exposed to the internet, waiting for an update. The correct way around this is make the browser 'query' in a timed manner using Javascript. Then using the XHTTP Request, you are able to 'check' the state.

On the mobile 'apple/blackberry' there are 'rentable' services that allow 'updates' to be pushed to specific mobile devices. But these are provided by apple or phone companies.
  • WritingBadCode
  • Graduate
  • Graduate
  • User avatar
  • Posts: 214
  • Loc: Sweden

Post 3+ Months Ago

may wrote:
On the question the other way around, the answer is no.

This would suggest that the remote user is exposed to the internet, waiting for an update. The correct way around this is make the browser 'query' in a timed manner using Javascript. Then using the XHTTP Request, you are able to 'check' the state.

On the mobile 'apple/blackberry' there are 'rentable' services that allow 'updates' to be pushed to specific mobile devices. But these are provided by apple or phone companies.


Ok, that answers my question... Thank you may! :)

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 136 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.