Monitoring connected clients in a room

Due to bad internet (speed & connection) I want to implement a new feature to monitor the connection of the clients in every room. So for instance if one client is disconnected I can have the log. Also I want to ping the clients in some intervals to check their speed and maybe get a trace-root. Identifying unique clients is another problem, I can use the IP address but if they are using vpns or using a NAT then that would not be a good solution. Using cookies is another way to approach the problem. I can save the connection status of clients in their browsers cookies. Of course this uses cases are just for personal test but I’m very new to the platform and don’t have any idea how to do the following:

  1. See connected clients
  2. Ping(or trace route) connected clients
  3. If a client in a room is disconnected, log the event in a file/db
  4. access client browsers cookies

I don’t know where should I start and can these tasks be accomplished using web servers like nginx? should I clone the repositories and make my changes in the source code? or there are other ways?

I would be thankful I you somebody could help me.