Today we will talk about
WaterSpout - a web server that can handle websockets requests, allowing you to communicate in real time between the server and the browser using
websockets or long polling. It is written in PHP.

First of all, there is a check whether websockets are supported (this is Chrome, Opera and FF, if enabled), if not, that's okay, long polling will be used.
The advantages of this technology: instant message delivery, high performance. Tested in Chrome, FF, IE6 +.
Demo .
How to run at home?
1.
Download2. Run in the command line: php server.php
3. Done:
http: // localhost: 7777 / demos / locke (port changes in config / config.php)
Software Requirements:
PHP 5.2.1 or higher.
The following extensions should be included: mbstring, sockets, openssl (if you want to use ssl)
Comparison and application:
Now the technology is usually used, in which the browser sends requests to the server after a certain amount of time. This approach either requires sending the same data (which your traffic eats), or the response comes with a delay, depending on the update interval. Using the same WaterSpout users can get the result immediately, as he came to the server.
With the help of WaterSpout it is possible to make browser-based multiplayer games, chats, services with instant interaction.
Demo for comparing technology websockets, long polling and short polling.
')
PS If you are interested in this architecture and want to try to develop something of your own - do not hesitate to write - write, I will help with everything I can. Any comments and feedback are welcome.
useful links
Related slidesIntegration with Kohan