Skip to content

Commit

Permalink
do not rause KeyError for unknown clients
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed May 27, 2016
1 parent 7fbc56d commit 82ffcfb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions flask_socketio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ def handle_my_custom_event(json):

def decorator(handler):
def _handler(sid, *args):
if sid not in self.server.environ:
# we don't have record of this client, ignore this event
return '', 400
app = self.server.environ[sid]['flask.app']
with app.request_context(self.server.environ[sid]):
if 'saved_session' in self.server.environ[sid]:
Expand Down

0 comments on commit 82ffcfb

Please sign in to comment.