@@ -617,6 +617,41 @@ callbacks when emitting. When the external process needs to receive callbacks,
617
617
using a client to connect to the server with read and write support is a better
618
618
option than a write-only client manager.
619
619
620
+ Monitoring and Administration
621
+ -----------------------------
622
+
623
+ The Socket.IO server can be configured to accept connections from the official
624
+ `Socket.IO Admin UI <https://socket.io/docs/v4/admin-ui/ >`_. This tool provides
625
+ real-time information about currently connected clients, rooms in use and
626
+ events being emitted. It also allows an administrator to manually emit events,
627
+ change room assignments and disconnect clients. The hosted version of this tool
628
+ is available at `https://admin.socket.io <https://admin.socket.io >`_.
629
+
630
+ Given that enabling this feature can affect the performance of the server, it
631
+ is disabled by default. To enable it, call the
632
+ :func: `instrument() <socketio.Server.instrument> ` method. For example::
633
+
634
+ import os
635
+ import socketio
636
+
637
+ sio = socketio.Server(cors_allowed_origins=[
638
+ 'http://localhost:5000',
639
+ 'https://admin.socket.io',
640
+ ])
641
+ sio.instrument(auth={
642
+ 'username': 'admin',
643
+ 'password': os.environ['ADMIN_PASSWORD'],
644
+ })
645
+
646
+ This configures the server to accept connections from the hosted Admin UI
647
+ client. Administrators can then open https://admin.socket.io in their web
648
+ browsers and log in with username ``admin `` and the password given by the
649
+ ``ADMIN_PASSWORD `` environment variable. To ensure the Admin UI front end is
650
+ allowed to connect, CORS is also configured.
651
+
652
+ Consult the reference documentation to learn about additional configuration
653
+ options that are available.
654
+
620
655
Debugging and Troubleshooting
621
656
-----------------------------
622
657
0 commit comments