Differences between revisions 1 and 2
Revision 1 as of 2013-03-05 19:41:24
Size: 1734
Editor: PieterSmit
Comment: Create notes
Revision 2 as of 2013-03-05 19:43:23
Size: 1810
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
  {{{ Exception: ('PythonOption mod_pywebsocket.handler_root is not defined', 3) }}}     1. {{{ Exception: ('PythonOption mod_pywebsocket.handler_root is not defined', 3) }}}
    1. {{{ AttributeError: object has no attribute "APLOG_DEBUG" }}}

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)  

      2.  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
    <IfModule python_module>
      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
      <Location /ws>
        PythonHeaderParserHandler mod_pywebsocket.headerparserhandler
      </Location>
    </IfModule>  
    
    <VirtualHost *:80>
    
            ServerAdmin webmaster@localhost
    
            DocumentRoot /var/www
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
            ErrorLog ${APACHE_LOG_DIR}/error.log
            LogLevel debug
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
  • 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

...


CategoryDevelopement

PyWebSocket (last edited 2016-01-12 07:21:41 by PieterSmit)