wangshen2014 / pywebsocket

Automatically exported from code.google.com/p/pywebsocket
0 stars 0 forks source link

Documentation not clear (or obsolete?) #99

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

  1. Follow the directions on the home page:

     "To run mod_pywebsocket as an Apache HTTP Server extension module,
     please read comments in pywebsocket-read-only/mod_pywebsocket/__init__.py."

  2. Copy examples/* to /var/www/html/websock_handlers
  3. Browse to http://example.com/websock_handlers/console.html
  4. Click "connect"
  5. Change "ws://example.com/echo" to "ws://example.com/websock_handlers/echo" and try again

What is the expected output? What do you see instead?

  Something other than:

    Connect ws://example.com/echo
    Closed (CloseEvent is not available)

What version of the product are you using? On what operating system?

  RHEL 6, Python 2.6.6, Apache 2.2.15, mod_python 3.3.1, mod_pywebsocket 0.6b1

Please provide any additional information below.

  I'm VERY new to websockets.  mod_pywebsockets is in the Python path. My Apache directives  are straight from __init__.py mentioned on the home page (sans the PythonPath, since I verified that "import mod_pywebsockets" worked without any alteration to the path):

  PythonOption mod_pywebsocket.handler_root /websock_handlers
  PythonHeaderParserHandler mod_pywebsocket.headerparserhandler

Original issue reported on code.google.com by dc.loco on 15 Jun 2011 at 10:46

GoogleCodeExporter commented 9 years ago
Hi,

I'd recommend trying running mod_pywebsocket as a standalone server (i.e., not 
using Apache HTTP Server) first if you haven't yet. The instruction is at 
http://code.google.com/p/pywebsocket/ Once you run it successfully, move on to 
run it with Apache. That way you can concentrate on Apache configuration issue.

Closing this bug because it is not a bug per se.

Original comment by yuzo@chromium.org on 16 Jun 2011 at 1:24

GoogleCodeExporter commented 9 years ago
Check the permissions of the files in /websock_handlers. I was having the same 
problem until I changed the permissions for "Others" to "Read-only". 

Original comment by daniel.r...@gmail.com on 17 Jun 2011 at 3:08

GoogleCodeExporter commented 9 years ago
We're using umask 027 on our development environment. On releasing the package, 
we didn't change permission. If you pass -p option to tar, it expands files 
with o-rx. Otherwise, it just creates files based on umask.

Original comment by tyoshino@chromium.org on 21 Jun 2011 at 7:42

GoogleCodeExporter commented 9 years ago
Hi all,

I had success several days ago but didn't reply since the bug was marked
invalid and closed.  But, since responses continue to trickle in, here's an
update:

I stand by my earliest assessment. ;-)  In particular, I'd suggest using an
example like /usr/local/.../websocket_handler for the example config in
__init__.py as it makes very clear that the path should be relative to the
file system.

As suggested early on in the thread, I went with standalone.py and also
found a bunch of blog postings that pointed the way.  I mentioned I was
brand new to the whole Web Socket scene.  So, the following is probably
obvious to others but wasn't to me.  (I hope it's right.)

Tip #1:

  On systems with Python 2.7, following the instructions will install
  mod_pywebsocket in /usr/local/lib/python2.7.  This leads to crapola
  regarding the number of arguments in readline().  No web search
  determined what the problem was. But copying the whole kit-n-
  kaboodle to /usr/local/lib/python2.6 and starting the standalone
  server with python 2.6 was the first key to a solution.

Tip #2:

  For testing with standalone.py, change to the directory where
  mod_pywebsocket lives, since it seems incapable of importing what's
  needed properly otherwise.

Tip #3:

  The standalone server not only needs a port, but the document root
  MUST point to where the console.html and friends are:

  $ cd /usr/local/lib/python2.6/dist-packages/mod_pywebsocket
  $ python2.6 standalone.py -p 4000 -d /.../pywebsocket

Tip #4:

  Following on the heels of Tip #3, the document root is relative to
  the file system.  Important to remember when configuring Apache
  that it's NOT relative to Apache's document root.

Tip #5:

  Not supplied, but searched for is favicon.ico, which results in a 404
  File not found message.  So, put one in the document root to keep the
  standalone server quiet.

Tip #6:

  Since we've specified a document root, make sure it doesn't appear
  elsewhere.  Browse to "http://localhost:4000/console.html"  And
  console.html figures out that it wants "ws://localhost:4000/echo"
  which is correct.

So long, and thanks for all the fish. ;-)

Original comment by dc.loco on 21 Jun 2011 at 8:48