MCPcopy Create free account
hub / github.com/miguelgrinberg/python-socketio / instrument

Method instrument

src/socketio/async_server.py:485–522  ·  view source on GitHub ↗

Instrument the Socket.IO server for monitoring with the `Socket.IO Admin UI `_. :param auth: Authentication credentials for Admin UI access. Set to a dictionary with the expected login (usually ``username``

(self, auth=None, mode='development', read_only=False,
                   server_id=None, namespace='/admin',
                   server_stats_interval=2)

Source from the content-addressed store, hash-verified

483 return await self.eio.sleep(seconds)
484
485 def instrument(self, auth=None, mode='development', read_only=False,
486 server_id=None, namespace='/admin',
487 server_stats_interval=2):
488 """Instrument the Socket.IO server for monitoring with the `Socket.IO
489 Admin UI <https://socket.io/docs/v4/admin-ui/>`_.
490
491 :param auth: Authentication credentials for Admin UI access. Set to a
492 dictionary with the expected login (usually ``username``
493 and ``password``) or a list of dictionaries if more than
494 one set of credentials need to be available. For more
495 complex authentication methods, set to a callable that
496 receives the authentication dictionary as an argument and
497 returns ``True`` if the user is allowed or ``False``
498 otherwise. To disable authentication, set this argument to
499 ``False`` (not recommended, never do this on a production
500 server).
501 :param mode: The reporting mode. The default is ``'development'``,
502 which is best used while debugging, as it may have a
503 significant performance effect. Set to ``'production'`` to
504 reduce the amount of information that is reported to the
505 admin UI.
506 :param read_only: If set to ``True``, the admin interface will be
507 read-only, with no option to modify room assignments
508 or disconnect clients. The default is ``False``.
509 :param server_id: The server name to use for this server. If this
510 argument is omitted, the server generates its own
511 name.
512 :param namespace: The Socket.IO namespace to use for the admin
513 interface. The default is ``/admin``.
514 :param server_stats_interval: The interval in seconds at which the
515 server emits a summary of it stats to all
516 connected admins.
517 """
518 from .async_admin import InstrumentedAsyncServer
519 return InstrumentedAsyncServer(
520 self, auth=auth, mode=mode, read_only=read_only,
521 server_id=server_id, namespace=namespace,
522 server_stats_interval=server_stats_interval)
523
524 async def _send_packet(self, eio_sid, pkt):
525 """Send a Socket.IO packet to a client."""

Callers 2

wrappedFunction · 0.95
test_missing_authMethod · 0.95

Calls 1

Tested by 2

wrappedFunction · 0.76
test_missing_authMethod · 0.76