HTML5 Web Socket
The HTML5 Web Socket API allows web applications to have two-way communication with a remote host.
Web applications are becoming increasingly more social and real-time. The Web Socket API allows web applications to open up persistent two-way connections to a server. This allows the web app to receive updates on real-time as they can now be pushed from the server to the web app. Web apps no longer need to poll the servers on a continuous basis checking for new data.
Create a Web Socket:
var WS = new WebSocket("ws://www.examle.com:1234");
Send a message to the server:
WS.send("hello from the browser");
Receive a message from the server:
WS.onmessage = function(e) {
// do something with e.data
}
Comments
blog comments powered by Disqus
Recent Posts