Utilizar websockets con Apache

Creo que los websockets tienen futuro, aunque aún está un poco complicado el meterle mano a la hora de desarrollar. Para quienes quieran usarlo en sus proyectos junto a Apache tan solo tendrán que permitir ejecutar Python en Apache e instalar pywebshocket.

Primero es necesario indicar que Apache reconozca Python en nuestro virtual host:

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On

Despues instalar pywebshocket:

sudo python setup.py build
sudo python setup.py install

Y por último indicar en el httpd.conf añadirlo al Apache:

PythonPath "sys.path+['/usr/local/lib/python2.6/dist-packages/mod_pywebsocket']"
PythonOption mod_pywebsocket.handler_root /home/travis/Desktop/websock_handlers
PythonHeaderParserHandler mod_pywebsocket.headerparserhandler

How to set up apache to serve html5 websocket applications with pywebsocket