Ich benutze geventwebsockets, aber kann nicht einmal die Beispiel-App funktionieren. Der folgende Code gibt mir den Fehler:Wie gevent websockets arbeiten?
Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 884, in handle_one_response self.run_application() File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/handler.py", line 88, in run_application return super(WebSocketHandler, self).run_application() File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 870, in run_application self.result = self.application(self.environ, self.start_response) File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/resource.py", line 90, in call raise Exception("No apps defined") Exception: No apps defined
from geventwebsocket import WebSocketServer, WebSocketApplication, Resource
class EchoApplication(WebSocketApplication):
def on_open(self):
print "Connection opened"
def on_message(self, message):
self.ws.send(message)
def on_close(self, reason):
print reason
WebSocketServer(
('', 8000),
Resource({'/': EchoApplication})
).serve_forever()
Ich habe im Kreis herumlaufen worden. Kann mir jemand helfen? Vielen Dank.