How to implement dual communication between server and client via http
Posted
by
Alex Sebastiano
on Stack Overflow
See other posts from Stack Overflow
or by Alex Sebastiano
Published on 2011-01-15T17:49:35Z
Indexed on
2011/01/15
17:53 UTC
Read the original article
Hit count: 216
I have a AJAX client which must receive messages from server. Some messages from server not like request-response type. For example, imaging game in which players can enter. Server must send to client info about player entering. But how can server send message to client via http without request from client?
Only decision that i can invent: client send request to server (getNewPlayerEnter request) with big timeout, server checks state of player set, if in set new players are, then server send info to client, if not server 'sleeps' on some time, and after 'sleeping' server checks players set again.
I think my desicion a little stupid(maybe not little). How implement it right?
p.s. sorry for my english
© Stack Overflow or respective owner