Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

AJAX push

Name: Anonymous 2011-01-12 10:27

We're writing a webserver in our spare time and we are now at the point where we want to explore new web features. What is the best way to do full asynchronous communication with javascripts? Can we just periodically check in javascript if we've received something? Or is this only possible if you do a XMLHttpRequest beforehand? Are there other methods?

Name: Anonymous 2011-01-12 11:02

>>1

have a URL that accept a since parameter and spits out records in an output like this:

[pre]
{
  timestamp: 132465466,
  results: [ ... ]
}
[/pre]

the idea here is that the client uses the timestamp from the previous result as the since parameter for the next query. the server knows it only needs to send the records that were created after that particular time.

next you create a javascript function that performs the XMLHttpRequest and processes the results, storing and using the timestamps. you run this function  with setInterval.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List