Jump to content

Dynamic server response


php_nub_qq

Recommended Posts

Hi. Can anybody tell me how I can make the server send out data to connected users upon an event? The case is say 2 people are sending messages, chatting, instead of having ajax calls every second is there a way to tell the server when to display new messages? I believe in order for this to happen the browser has to not close the connection to the server but as my nickname states I'm not that good and I don't know how to do this hence I'm asking :P

Link to comment
Share on other sites

I watched a bunch of tutorials and this seems so complicated to me. I just want to ask one last thing before I dive into this because I just had an idea that doesn't seem that bad to me but of course I need to ask first. So the idea is that just like polling to send a request from the client but instead of returning the wasteful "no new data" the server goes through an infinite loop with a sleep of say 1 sec and exits the loop only if there's new data? The call from the client will be synchronous ( or asynchronous I don't really know which one lol but basically the one that can't be sent more than once until it's returned ). Is this a good option ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.