Errors with version 0.9.2 and flask-sockets

Anonymous avatarAnonymous created an issue

Hi, I am running into this issue (which does not occur if I use gevent-websocket 0.3.6):

2014-01-29 16:12:54,077 (geventwebsocket.handler) Closed WebSocket
Traceback (most recent call last):
  File "/home/xxxxx/local/lib/python2.7/site-packages/gevent/pywsgi.py", line 508, in handle_one_response
    self.run_application()
  File "/home/xxxxx/local/lib/python2.7/site-packages/geventwebsocket/handler.py", line 76, in run_application
    self.run_websocket()
  File "/home/xxxxx/local/lib/python2.7/site-packages/geventwebsocket/handler.py", line 52, in run_websocket
    self.application(self.environ, lambda s, h: [])
  File "/home/xxxxx/local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/xxxxx/local/lib/python2.7/site-packages/flask_sockets.py", line 40, in __call__
    handler(environment)
  File "/home/xxxxx/testskope/testskope.py", line 527, in running_log
    while ws.socket:
AttributeError: 'WebSocket' object has no attribute 'socket'
{'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'Upgrade',
 'HTTP_COOKIE': 'session=.eJytj8uKwjAYhV8l_OsiTGg3BRcDvaCQzDigIRlEYv3tNe3QRJRI312pA_MCszp8m--cc4fDudO2Qgvx9x2Ie8URYjiKnS9o1qvNcglTAJ8daoukG0pS98QNRBcFWktcVVvyo0tcwH4K_sGxD56jRrQVxG684JPqE8S_Ru5Xb0qkV5XIUHrVqZyFTMiQm5mNSrae5SmVZjs3FnY8H9zQYv-noJn5EFmr8nUjxVfFvGq5LyOVvIdcSMoaeWPJJuJURrxJr6xpb7x8HbhYHOc5oE-m7mF6AJzdZ0c.Bcpsrg.SWKHy-JDtWhEQApV9MySomjkFhM',
 'HTTP_HOST': 'localhost:5000',
 'HTTP_ORIGIN': 'http://localhost:5000',
 'HTTP_PRAGMA': 'no-cache',
 'HTTP_SEC_WEBSOCKET_EXTENSIONS': 'x-webkit-deflate-frame',
 'HTTP_SEC_WEBSOCKET_KEY': 'HoUpWayczrorwQh9Q2dvAA==',
 'HTTP_SEC_WEBSOCKET_VERSION': '13',
 'HTTP_UPGRADE': 'websocket',
 'HTTP_USER_AGENT': 'XXXXXXXXXXXXXXXXXXXX',
 'PATH_INFO': '/websocket/test/logs',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_PORT': '34212',
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'helios',
 'SERVER_PORT': '5000',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7',
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f365dfd0270>,
 'wsgi.input': <gevent.pywsgi.Input object at 0x2afd1d0>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0),
 'wsgi.websocket': None,
 'wsgi.websocket_version': '13'} failed with AttributeError

What could be the problem? I am using the flasks-sockets library for the routing stuff.

Comments (3)

  1. Aniket Panse

    Hi, I am the original reporter of this bug. Fixed the issue by doing something like this:

            while not ws.closed:
                try:
                    ws.send("Hi")
                except WebSocketError:
                    return ''
                gevent.sleep(2)
    
  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.