socketio / socket.io-admin-ui

Admin UI for Socket.IO
https://admin.socket.io
MIT License
346 stars 94 forks source link

Dashboard does not show all tabs and data #56

Closed lt692 closed 1 year ago

lt692 commented 1 year ago

image

I googled and could not find any solution to my problem so please help me out.

I am using strapi v4 inside the index.js bootstrap function I defined my sockets. They are working with no problems.

I wanted to launch admin.socket.io to start implementing some more logic, but when connected to the admin dashboard I don't see much. only two tabs.

index.js file

"use strict";
module.exports = {
  /**
   * An asynchronous register function that runs before
   * your application is initialized.
   *
   * This gives you an opportunity to extend code.
   */
  register(/*{ strapi }*/) { },

  /**
   * An asynchronous bootstrap function that runs before
   * your application gets started.
   *
   * This gives you an opportunity to set up your data model,
   * run jobs, or perform some special logic.
   */
  bootstrap({ strapi }) {
    const io = require("socket.io")(strapi.server.httpServer, {
      cors: {
        origin: ["https://admin.socket.io"],
        credentials: true
      },
    });

    const { instrument } = require('@socket.io/admin-ui');

    io.on("connection", function (socket) {
      console.log(`Connected ${socket.id}`);
    });

    strapi.io = io;
    instrument(io, { auth: false });
  },
};
darrachequesne commented 1 year ago

Hi! Which version of @socket.io/admin-ui are you using?

It seems the mode is set to production, which is why only the overview information is displayed.

afrancis-caregility commented 1 year ago

Hi @darrachequesne, Can we show some more information when the mode is set to production. The Admin UI is not very useful for me when the mode is production. I would prefer to see the sockets, rooms & clients tabs. Don't need the events or the other options to modify (leave, join, disconnect) but would like to see the sockets and rooms and additional metadata set on the sockets. Just seeing the dashboard and server tabs doesn't serve much purpose for me. You can also perhaps add some new attributes to show these tabs in production mode. Like showSockets = true, showRooms=true etc. image

darrachequesne commented 1 year ago

@afrancis-caregility doesn't the development mode suit your use case? Tracking all sockets is quite CPU/memory hungry, hence the production/development modes.

afrancis-caregility commented 1 year ago

Yes, it does but I am afraid to put development mode in Production. I will do some load testing and see how the platform behaves in development mode. This admin UI has been invaluable in helping me figure out what is going on with socket.io server & clients and so I would also prefer to have this capability in Prod to debug issues. I am more interested in seeing the data the socket holds and which rooms they are part of. So, that's why I wanted to see those two tabs. Is it possible to get data at a point in time by clicking a "load client data" rather than real time status updates if that makes it easier in production mode. This way we can load whatever sockets and rooms are available when user connects to Admin UI and then we can do a manual refresh to fetch the latest data again. We definitely don't want any monitoring tool taking up lot of memory/CPU in Prod.

MixxxxxxxxH commented 1 year ago

https://socket.io/docs/v4/admin-ui/ This page: "Default value: development"

@afrancis-caregility doesn't the development mode suit your use case? Tracking all sockets is quite CPU/memory hungry, hence the production/development modes.

IlyaDiallo commented 1 year ago

https://socket.io/docs/v4/admin-ui/ This page: "Default value: development"

@afrancis-caregility doesn't the development mode suit your use case? Tracking all sockets is quite CPU/memory hungry, hence the production/development modes.

Yes but the NODE_ENV overrides this setting and in Heroku (for instance) it defaults to "production"

darrachequesne commented 1 year ago

@IlyaDiallo in that case, you need to explicitely specify mode: development, which should override the NODE_ENV variable.

See also: https://github.com/socketio/socket.io-admin-ui/blob/158864989dddeba67df9975a4cad48ef310f8c80/lib/index.ts#L544-L554

Can we show some more information when the mode is set to production. The Admin UI is not very useful for me when the mode is production. I would prefer to see the sockets, rooms & clients tabs.

Tracking all sockets/rooms requires a lot of memory, this is why it's only enabled in development mode.

I'm closing this, as I don't think there is much we can do. Please reopen if needed.