##master-page:HomepageReadWritePageTemplate ##master-date:Unknown-Date #format wiki #language en = Websockets = * 2013 - New way for javascript to open a tcp connection back to the server for data transfer. * Here is some notes as I struggled to get the first examples to work. * Errors in apache log files 1. {{{ Exception: ('PythonOption mod_pywebsocket.handler_root is not defined', 3) }}} 1. {{{ AttributeError: object has no attribute "APLOG_DEBUG" }}} * Cause was that i had to have the websocket config above the default virtual server in my apache2 config file. {{{ ##PES 2013 pywebsocket PythonPath "sys.path+['/mod_pywebsocket']" PythonOption mod_pywebsocket.handler_root /var/www PythonOption mod_pywebsocket.handler_scan /var/www/ws #PythonOption mod_pywebsocket.allow_draft75 On PythonHeaderParserHandler mod_pywebsocket.headerparserhandler ServerAdmin webmaster@localhost DocumentRoot /var/www Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel debug CustomLog ${APACHE_LOG_DIR}/access.log combined }}} * To test 1. copy file '''echo_wsh.py''' into /var/www/ws 2. open webpage to test '''file:///usr/share/doc/python-mod-pywebsocket/examples/console.html''' in browser 3. test by entering in webpage abe the url '''ws://localhost/ws/echo''' 4. on web page in display window you should see message '''Connect ws://localhost/ws/echo''' * Another problem was with /var/www/ws/websockify_wsh.py * Found in Apache2 log '''websockify: ws_protocol = 'binary' (['binary', 'base64'])''' * It was picking binary for socket and noVNC only supports base64. * Solution, just before it picked the first option, i check for base64 and rather select it. * Another problem, connecting with vnc.html, found in apache2 log. {{{mod_pywebsocket: websockify: connection denied: 'NoneType' object has no attribute 'split'}}} ... ---- CategoryDevelopement