Results 1 to 4 of 4

Thread: Socket Functionality with Ajax?

  1. #1
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default Socket Functionality with Ajax?

    I was wondering if you could send a request on page load, and the server could wait until it wanted to send you something (like a new thread in a forum) and then you would start another request to give your answer and the server would wait on that. And it would continue. Would that work? My friend said no, but the reason he gave was absurd.

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ??? View Post
    I was wondering if you could send a request on page load, and the server could wait until it wanted to send you something (like a new thread in a forum) and then you would start another request to give your answer and the server would wait on that. And it would continue. Would that work?
    Depends how long the wait is: the connection would time-out if it were much longer than say, thirty seconds. Keep in mind that HTTP is a stateless request-response protocol. The only reason to maintain a connection is to reduce traffic: to share the connection for a number of requests. Even so, the connection is still transient.
    Mike

  3. #3
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default

    Thanks for the help, but there's some way to change the timeout time, isn't there?

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ??? View Post
    Thanks for the help, but there's some way to change the timeout time, isn't there?
    No. The client will have it's own time-out threshold, and so will the server. You might be able to affect how long the server is willing to wait, but you cannot control when the client will decide to close the connection.
    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •