WaterSpout is Web Server for Asynchronous Data Transfer
Today, we will discuss the WaterSpout. This web server can process websockets queries, allowing communicating in the real time between a server and browser using websockets or long polling. It is written in PHP.
First of all, it verifies whether supports websockets (these are Chrome, Opera and FF, if they are included), if not, we should not worry, because the long polling will be used.
These are benefits of this technology: the instant message delivery and high performance. It is tested in Chrome, FF, IE6 +.
Here is a demo.
How can we run at home?
2. Run in the command line: php server.php
3. Done: http://localhost:7777/demos/locke ( port changes to config /config.php)
Requirements for the software:
PHP 5.2.1 or higher.
There should be included the following extensions: mbstring, sockets, openssl (if you want to use ssl)
Comparison and use:
Today, it is used the technology, when the browser sends a queries to the server after a certain period of time. This approach requires the transfer of the same data (that is cutting the traffic), or the answer comes delayed, depending on the interval for updates. Using the WaterSpout users can get results as soon as it came to the server.
It is possible via WaterSpout to do the browser-based multiplayer games, chat rooms, services with instantaneous interactions.
Here is a demo for comparison of technologies websockets, long polling, and short polling.
P.S. If you are interested in this architecture and want to try to develop something new, please do so. Any comments are welcome.
WaterSpout integration with Kohana’s framework
|Vote for this post
Bring it to the Main Page