Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality✓ Free Actions
Free to watch • No registration required • HD streaming
As HTML5 grows more in popularity we're going to find that more and more websites will start integrating real-time updates with WebSockets and stray away from the traditional polling method.
What is the difference?
Polling is when the browser queries for data back from the server every XX amount of time. This method is generally less efficient because you are querying the server for new data that may or may not be there. In addition to this, HTTP requests require oh so many bytes because of all of the headers that accompany each request. To sum it up the client is "pulling" data from the server.
Real-Time updating is more of a "push" since the server sends any new data it receives to the client. This is a more favorable approach since it requires less traffic to and from the server and your client can see things changing... in real-time. There are a two major techniques to implement this "pushing" method: long-polling and websockets.
Long-Polling
A very simple concept. The user will send a HTTP request to the server, which is kept open until the server gets new updated data. Once this occurs the server will push it to the user through a regular HTTP response which will cause the user to re-request the server and the process starts all over again.
Websockets
This is a new HTML5 protocol used for bidirectional communication usually meant for browser to server communication. What does that mean? No more HTTP requests which means no more unnecessary headers. If you refer to the official website you can see the efficiency tests done, but in general a ws:// message is reduced by roughly 800 bytes and that is not even including the number of unnecessary requests traditional polling does.
Websockets vs Long-Polling
As of right now WebSockets are only supported by modern browsers excluding IE. Check out the caniuseit site to get a full list of compatibility. I've previously tested long-polling using the Comet technique and the Orbited module. Refer to the diagram below
I followed this blog post and got everything up and running, but it seems the last time any of these packages or blog posts were updated was back in 2009, so using this method seems outdated and more trouble than its worth. In addition to this, I've read that long-polling can only support a few hundred open connections at a time, while a WebSocket server can maintain about a thousand open connections. (I haven't tested this). The Comet technique, however, currently has one huge advantage over the use of WebSockets in that it is mostly compatible with all major browsers since Comet is only a hack to keep the client-server connection open and not a completely new protocol (ws:// vs http://).
Getting Started with WebSockets
The easiest way to get started is to look at the node.js package which has a large and growing community and many additional modules including socket.io, which is responsible for maintaining websocket (or other) real-time open connections.