Skip to content

Commit

Permalink
add use_reloader option to socketio.run() (fixes #59)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Jan 4, 2015
1 parent fe50fda commit 760b61c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flask_socketio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ def run(self, app, host=None, port=None, **kwargs):
else:
port = 5000
resource = kwargs.pop('resource', 'socket.io')
use_reloader = kwargs.pop('use_reloader', app.debug)

self.server = SocketIOServer((host, port), app.wsgi_app,
resource=resource, **kwargs)
if app.debug:
if use_reloader:
# monkey patching is required by the reloader
from gevent import monkey
monkey.patch_all()
Expand All @@ -253,6 +255,7 @@ def run_server():
_log('info', ' * Running on http://%s:%d/' % (host, port))
run_with_reloader(run_server)
else:
_log('info', ' * Running on http://%s:%d/' % (host, port))
self.server.serve_forever()

def test_client(self, app, namespace=None):
Expand Down

0 comments on commit 760b61c

Please sign in to comment.