Jun 6th, 2010 Archives

web development done right
Is there a way to receive updates using ajax in real time?

Hello everyone! I am a web developer in my op students within the right-co Now. although this issue is not really work related but I'm just curious. I have very rich experience with most web development techniques, but one thing I always wanted to do is a simple multi-player online gaming (such as card games) with ajax (along with php, mysql ….) eligible actions other players in real time. which means that if a player makes a move then everyone knows right away. you could say "why not just use java applet or flash? ". well .. just curious. I tried to make ajax requests to server send and receive updates periodically (eg every 3 seconds). but still very slow and inefficient, particularly when you're playing one game. so .. Is there any way? thanks!

Well, what we need is a service on the server that the client receives the data and sends it to other customers connected to that server. I do not know exactly how to do that with Ajax, but I can tell you how I did it with Flash. For Flash I used something called a server socket. Basically what he did was to establish a link with users when they register in. They then had an outlet socket server and can communicate with all sockets live. The socket server obtained the data from each client and could be sent to all available connectors (or whatever is necessary data). Therefore you can do with Ajax, but it's only a matter of what type of service or whatever on the server you can use to create unique connections with each client and be able to communicate with them in real time. His problem, then it is not Ajax on the client is greatest in server technology to handle real-time communications to each unique customer.


Related Blogs

Filed under Uncategorized by on . Comment#