Connection information in Galaxy differs from local development

Hello I’m trying to do some auditing of the problems I have with the number of connections on the server respect to the low number of users.
For that I’m trying to save some info in the db in order to check later, in dev I’m running this code

const connections =Meteor.server.stream_server.all_sockets().map((connection) => {
      return {
        url: connection.headers.referer,
        userId:  connection._meteorSession && connection._meteorSession.userId,
        sessionId:  connection._meteorSession && connection._meteorSession.id,
      }
    })

Which works great, but on the server in galaxy the url is null, and I don’t see a way of getting the url the connection is currently visiting.
Anyone knows how to get this information?
Thanks in advance

I’ve been getting the url when I need it from the webapp request object webapp | Meteor API Docs

e.g

WebApp.connectHandlers.use('/', (req, res, next) => {
  console.log(req); 
});

Thanks for the response, but we are looking for checking which page each connection is in, so this wouldn’t work, it will just log the queries to the server. The problem we are having is that we have connections that are not used and we want to see where they are stuck. And correlating these logs with the connections is going to be near impossible

Would it be too much to add an analytics platform (Google or for privacy a self installed like https://matomo.org/ and log all your visits, with connection ids, users, session time etc).

Do you use auto-disconnect for your client sessions?

1 Like

Req contains the url…? That’s how my apps are doing it but up to you bro.

To check which page they are in on client you can simply check window.location on server you must check the request. AFAIK there is no other way to retrieve this besides these two routes or the alternative is coding a sub command wrapper that takes the page as a additional argument.

Best practice way is to name the sub for the use. Then you will know for sure. Because it will narrow it down to where the sub is. And most of my screens only use one sub for one or two places.

Thanks a lot for the answers will look into it.