Skip to content

Commit

Permalink
Enable instrumentation by default in WSGI and ASGI examples
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Dec 29, 2024
1 parent 8fe012a commit 269332d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion examples/server/asgi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# set instrument to `True` to accept connections from the official Socket.IO
# Admin UI hosted at https://admin.socket.io
instrument = False
instrument = True
admin_login = {
'username': 'admin',
'password': 'python', # change this to a strong secret for production use!
Expand Down Expand Up @@ -93,4 +93,14 @@ def test_disconnect(sid, reason):


if __name__ == '__main__':
if instrument:
print('The server is instrumented for remote administration.')
print(
'Use the official Socket.IO Admin UI at https://admin.socket.io '
'with the following connection details:'
)
print(' - Server URL: http://localhost:5000')
print(' - Username:', admin_login['username'])
print(' - Password:', admin_login['password'])
print('')
uvicorn.run(app, host='127.0.0.1', port=5000)
12 changes: 11 additions & 1 deletion examples/server/wsgi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# set instrument to `True` to accept connections from the official Socket.IO
# Admin UI hosted at https://admin.socket.io
instrument = False
instrument = True
admin_login = {
'username': 'admin',
'password': 'python', # change this to a strong secret for production use!
Expand Down Expand Up @@ -99,6 +99,16 @@ def disconnect(sid, reason):


if __name__ == '__main__':
if instrument:
print('The server is instrumented for remote administration.')
print(
'Use the official Socket.IO Admin UI at https://admin.socket.io '
'with the following connection details:'
)
print(' - Server URL: http://localhost:5000')
print(' - Username:', admin_login['username'])
print(' - Password:', admin_login['password'])
print('')
if sio.async_mode == 'threading':
# deploy with Werkzeug
app.run(threaded=True)
Expand Down

0 comments on commit 269332d

Please sign in to comment.