php - How can I establish connection between a client and a server where the server sends new messages to the client? -
i need establish connection between client , server via php websocket.
the server need keeps checking external api new messages , send them client.
i understand concept can code it. have questions me wrap around head.
the client side keep making calls server via websocket every second using javascript's setinterval()
function or make 1 call? how client know server have new messages?
the server side create script runs infinite loop keep checking api , echo results?
websocket how websocket know connection message belong to?
i not sure if matter going use ratchet creating websocket
on past days, solved problem via comet. , used php,node.js. should check comet technology , php , node.js.
http://blog.jamieisaacs.com/2010/08/27/comet-with-nginx-and-jquery/
etc.
Comments
Post a Comment