This project is not covered by Drupal’s security advisory policy.

This module is NOT production site ready. Please test locally, or behind a firewall and provide bug reports/feedback.

This module enables other modules to include WebSockets (http://dev.w3.org/html5/websockets/) functionality. It has a very simple API (currently in development), to allow PUSH updates to be sent to Drupal users.

Examples

Examples of the use of PUSH updates include:

  • Chat rooms - Messages sent be other users are displayed immediately on screen.
  • Collaborative editing - Similar to how Google Docs allows you to see the text that another user is typing.
  • Email - The moment an email is received on the server, it is displayed in the clients webmail - no need to refresh.
  • Stocks/Shares - Prices change on the users web page without having to reload/refresh the page. Prices are also realtime, meaning there is no delay between the price actually changing, and the user seeing the change.
  • Live streaming of video both broadcast and record (e.g. Chatroulette).

Example modules are included that implement the two highlighted examples above. They are both very simple modules, and should not be used on a production site.

Libraries

The module uses two key software libraries to enable the use of WebSockets. These are:

  • Web Socket JS - An excellent JavaScript library that falls back to using Flash in the event that the client does not support WebSockets. Currently only Chrome, Safari and Firefox (defaults to off) support WebSockets, while the Flash plugin works in most other browsers.
  • Extendible Web Socket Server (PHP) - A simple, but very effective PHP based WebSockets server. The API will be improved to make extending the server much simpler.

How?

The WebSockets server listens, by default, on port 8080 of your server. In order to change this, you must edit the websockets.server.php file (I will change this to a separate config file for the first release of the project). Note, this can not be a Drupal setting, as the same server is used across all sites in a multi-site install.

In order for a WebSockets server instance to be started, you must be using a Linux server. The server is started the first time a site, with the WebSockets module enabled, is accessed. The "nohup" command is used to ensure that the server keeps running in the background, listening for connections. If you find that your web server is unable to start a WebSockets server, then you can manually start one using the following command:

$ php -q /path/to/websockets/module/websockets.server.php

You must then create a text file "/tmp/websockets.pid" with the PID of the process you have just started.

Development of this module was funded by ViBRANT.

Project information

Releases