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

Method instrument

src/socketio/server.py:466–503  ·  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

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

Callers 4

wrappedFunction · 0.95
test_missing_authMethod · 0.95
app.pyFile · 0.45
app.pyFile · 0.45

Calls 1

InstrumentedServerClass · 0.85

Tested by 2

wrappedFunction · 0.76
test_missing_authMethod · 0.76