Hi, I am running a server on OpenShift. I run it with cherrypy embedded in a WSGI environment. My application has some websockets too.
This is how, I initialized the WSGI application object:
class Root(object):
def index(self): return 'I work!'
def ws(self): print('ws request handler: ', cherrypy.request.ws_handler)
cherrypy.config.update({'environment': 'embedded'})
if cherrypy.__version__.startswith('3.0') and cherrypy.engine.state == 0:
cherrypy.engine.start(blocking=False)
atexit.register(cherrypy.engine.stop)
WebSocketPlugin(cherrypy.engine).subscribe()
cherrypy.tools.websocket = WebSocketTool()
conf['/ws']={'tools.websocket.on': True, 'tools.websocket.handler_cls': MyWebSocketClient}
application = cherrypy.Application(Root(), script_name='', config=conf)
Everything works fine, but when I try to connect to the websocket, from browser, I get:
cherrypy/_cplogging.py, 214, HTTP Traceback (most recent call last):
File "cherrypy/_cprequest.py", line 661, in respond
self.hooks.run('before_request_body')
File "cherrypy/_cprequest.py", line 114, in run
raise exc
File "cherrypy/_cprequest.py", line 104, in run
hook()
File "cherrypy/_cprequest.py", line 63, in __call__
return self.callback(**self.kwargs)
File "ws4py/server/cherrypyserver.py", line 200, in upgrade
ws_conn = get_connection(request.rfile.rfile)
AttributeError: 'mod_wsgi.Input' object has no attribute 'rfile'
Any idea? should I put something more, so the websocket can work under a WSGI-zed cherrypy?
thanks!
PS: I deleted my recent post since I realized I put a wrong stacktrace, this is the right one!