Web development

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?

1. Download
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.

Useful links

Slides share
WaterSpout integration with Kohana’s framework
Pirat 28 september 2011, 13:01
Vote for this post
Bring it to the Main Page


Leave a Reply

Avaible tags
  • <b>...</b>highlighting important text on the page in bold
  • <i>..</i>highlighting important text on the page in italic
  • <u>...</u>allocated with tag <u> text shownas underlined
  • <s>...</s>allocated with tag <s> text shown as strikethrough
  • <sup>...</sup>, <sub>...</sub>text in the tag <sup> appears as a superscript, <sub> - subscript
  • <blockquote>...</blockquote>For  highlight citation, use the tag <blockquote>
  • <code lang="lang">...</code>highlighting the program code (supported by bash, cpp, cs, css, xml, html, java, javascript, lisp, lua, php, perl, python, ruby, sql, scala, text)
  • <a href="http://...">...</a>link, specify the desired Internet address in the href attribute
  • <img src="http://..." alt="text" />specify the full path of image in the src attribute