javascript - Get Refesh Data From The Server -
how can latest or fresh data server (if in server happened new event (for example there 2 users x,y , x send messages y , y message without refreshing page ) )? don't want use setinterval because repeats message again , again. there technique can use ? heard ajax technique need send request server want when happen event in server , webpage without refreshing..
the first technique long polling, sends request server , waits until server sends something, example new message. must re-send requests server each time new message or request time out. technique uses ajax. long polling php example - how implement basic "long polling"?
the second web sockets, https://en.wikipedia.org/wiki/websocket
this stackoverflow question deals implementation of websocket.
socket.io has demo of chat application.
Comments
Post a Comment