Extension:WebSocket
This extension allows the wiki to respond dynamically to change events using WebSockets instead of Ajax polling. It currently doesn't have any fall-back to Ajax because it was written primarily to augment extensions that already use Ajax polling such as AjaxComments, so these extensions will just continue with Ajax polling as usual if the WebSocket extension is not present or is present but not connected.
Installation
The extension itself is installed the usual way with an include of WebSocket.php in your LocalSettings.php file. Note that the extension must reside within a directory called "WebSocket" directly in the wikis extensions directory.
There is also a background Perl daemon called WebSocket.pl which is started by the PHP if it's found not to be running. The daemon uses the Net::WebSocket::Server library to implement a minimal WebSocket service.
Configuration
The configuration options for the extension are set after the include statement in your LocalSettings.php and are as follows.
Name | Default | Description |
---|---|---|
WebSocket::$port | 1729 | Port the WebSocket daemon will run on |
WebSocket::$rewrite | false | Configure URL rewriting so that the WebSocket port doesn't need to be public |
WebSocket::$perl | /usr/bin/perl | Location of the Perl interpreter |
The "rewrite" option
This option is used if the server environment doesn't allow new ports to be open to the public. If it's set then the WebSocket requests will be directed to the same domain and port as the wiki is running on with the URI of /websocket. The web-server must be configured to match this URL and redirect it to the local WebSocket daemon's port.