Skip to content

Commit 269332d

Browse files
Enable instrumentation by default in WSGI and ASGI examples
1 parent 8fe012a commit 269332d

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

examples/server/asgi/app.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

9494

9595
if __name__ == '__main__':
96+
if instrument:
97+
print('The server is instrumented for remote administration.')
98+
print(
99+
'Use the official Socket.IO Admin UI at https://admin.socket.io '
100+
'with the following connection details:'
101+
)
102+
print(' - Server URL: http://localhost:5000')
103+
print(' - Username:', admin_login['username'])
104+
print(' - Password:', admin_login['password'])
105+
print('')
96106
uvicorn.run(app, host='127.0.0.1', port=5000)

examples/server/wsgi/app.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

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

100100

101101
if __name__ == '__main__':
102+
if instrument:
103+
print('The server is instrumented for remote administration.')
104+
print(
105+
'Use the official Socket.IO Admin UI at https://admin.socket.io '
106+
'with the following connection details:'
107+
)
108+
print(' - Server URL: http://localhost:5000')
109+
print(' - Username:', admin_login['username'])
110+
print(' - Password:', admin_login['password'])
111+
print('')
102112
if sio.async_mode == 'threading':
103113
# deploy with Werkzeug
104114
app.run(threaded=True)

0 commit comments

Comments
 (0)